Skip to content

Instantly share code, notes, and snippets.

@itsmikita
Last active April 10, 2019 12:27
Show Gist options
  • Save itsmikita/7faf5cbfd0584429c2fcb965cd447e4f to your computer and use it in GitHub Desktop.
Save itsmikita/7faf5cbfd0584429c2fcb965cd447e4f to your computer and use it in GitHub Desktop.
Install PHP 7.2.15 on Mac OSX El Captain 10.11.6

Install PHP 7.2.15 on Mac OSX El Captain 10.11.6

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.

  1. Install Homebrew and ignore all the warnings that your Mac OSX is outdated, just follow the instuctions here:

https://github.com/Homebrew/brew

  1. Install PHPBrew, follow the instructions here:

https://github.com/phpbrew/phpbrew

  1. 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

  1. 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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment