I made this self-reminder public for anyone who need PHP7+ running on older Macs, since I had to do some shaman things to make it work.
- Install Homebrew and ignore all the warnings that your Mac OSX is outdated, just follow the instuctions here:
https://github.com/Homebrew/brew
- Install PHPBrew, follow the instructions here:
https://github.com/phpbrew/phpbrew
- Now, since I needed a WordPress install to run properly I checked what PHP extensions/libraries are required. Here the official list:
https://make.wordpress.org/hosting/handbook/handbook/server-environment/#php-extensions
NOTE: I did not manage to install GD libraries (perhaps I'll fix it later, or if you managed to fix it, let me know in the comments below)
First, I install OpenSSL, Mcrypt and PCRE with Homebrew:
brew install mcrypt openssl pcre
- The last but not least is to install the PHP 7.2.15 itself:
phpbrew install 7.2 +bcmath +ctype +curl +exif +filter +fileinfo +ftp +hash +json +mcrypt +mysql +openssl='/usr/local/opt/openssl' +pcre +pdo +sockets +zlib
NOTE: You can have multiple PHP installations with PHPBrew and switch between them, run:
phpbrew use php-7.2.15
DISCLAIMER: If you encounter any errors you would need to fix them, delete the failed PHP installation and start over with Step 4 again. To delete the PHP install run:
phpbrew remove php-7.2.15
Enjoy your coffee!