7

I have some old mac machines that can not update to Big Sur. So when using brew to install [email protected] brew will complain "no bottle available". I updated brew to latest 2.7.5, brew then complained,

Warning: You are using macOS 10.12. We (and Apple) do not provide support for this old version. You will encounter build failures with some formulae.

I tried brew build from source but that also failed. So far the only solution I can found is from https://php-osx.liip.ch/, but https://php-osx.liip.ch/ has deprecated and only support to 7.3.8. So is it possible to install php 7.4 or latest 8.0 on these old mac ?

--- update ---

One comment suggested to use macports. I tried macports on 10.13 and installed php 7.4!

5
  • Can't you just build from source directly (php.net/manual/en/install.unix.php)?
    – nohillside
    Jan 21, 2021 at 7:17
  • I didn't tried that because I am not a php expert. Besides, brew build from source failed and let me less confident to build from source directly. Jan 22, 2021 at 9:21
  • 2
    MacPorts seems to have php74 available for 10.12
    – root
    Jan 22, 2021 at 22:30
  • Does this machine only support Sierra as its last OS? It would seem prudent to get onto an at least supported version of the OS... Mojave and Catalina are still receiving security updates. Jan 23, 2021 at 17:07
  • I have 2 old mac, one can only upgrade to Sierra (The one I list here) another can upgrade to high Sierra. Both can't use brew to install php 7.4 with the same error. Jan 24, 2021 at 12:12

1 Answer 1

8

Yes, you can upgrade to latest php version on mac without homebrew. For me I use MacPorts a package manager for MacOS which is similar to HomeBrew but more stable and it supports old version of OSX back to 10.4 whilst Homebrew tends to support only the last 3 versions. (php74 appears to have prebuilt versions back to Snow Leopard https://ports.macports.org/port/php74/details/)

Example to upgrade to php74:

sudo port install php74

Install the extensions you need

sudo port install php74-cgi php74-gd php74-curl php74-intl php74-iconv php74-gettext php74-mbstring php74-imap php74-mcrypt php74-xmlrpc php74-mysql php74-openssl php74-sockets php74-zip php74-tidy php74-opcache php74-xsl php74-sqlite

Select php74 as the active PHP version. With this command you can have multiple php version and quickly switch from one to the other.

sudo port select php php74

Check which PHP binary is used (should return /opt/local/bin/php). Perhaps you may need to restart you terminal.

which php

Check the version (should return “PHP 7.4.XX (cli)…”)

php --version

Also, If you use XAMPP ensure to restart Apache Web server.

(Article Reference)

2
  • This is a great answer thank you very much Jul 18, 2022 at 14:53
  • For MacOs Catalina, this is the best way to upgrade the PHP 7.3 default installed version (after failing using Homebrew during hours). Thankyou ! Jun 17 at 11:36

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .