These are my instructions for compiling a new version of PHP via Phpbrew on Mac High Sierra, with the latest versions of cURL and OpenSSL that Composer seems to need.
/usr/local/bin
must come before /usr/bin
in the PATH
when using Homebrew.
export PATH=/usr/local/bin:$PATH
brew doctor # Fix any bits you can from here
brew update
brew upgrade
brew install openssl
Homebrew now considers openssl to be keg-only, which means it's installed in your machine under /usr/bin/Cellar
but isn't symlinked by default.
Take note of the version you have at the end.
This is also keg-only. The --nghttp2
adds HTTP/2 support. See this post.
brew install curl --nghttp2
Take note of the version you have at the end.
Note: For VVV (Ubuntu 16.04), you'll need to sudo apt install libcurl4-openssl-dev
in order to install libcurl which ext-curl relies on.
brew install gettext
Take note of the version you have at the end.
brew install bzip2
Take note of the version you have at the end.
phpbrew self-update
phpbrew update
phpbrew known
The custom paths are the ones that contain the respective bin/...
directory. Update the OpenSSL and cURL versions as needed, with the versions you have installed.
Note, that the command below excludes gettext, since PHP 7.1.5 and above seems to have an issue with adding iconv extension with gettext extension. Instead, we add iconv as part of the build, and after, add gettext.
phpbrew --debug install 7.2.10 +default +soap +pdo +mysql +openssl=/usr/local/Cellar/openssl/1.0.2p -- --with-iconv=/usr/bin/iconv --with-curl=/usr/local/Cellar/curl/7.61.0 --with-bz2=/usr/local/Cellar/bzip2/1.0.6_1 --with-zlib=/usr/local/opt/zlib
phpbrew ext install gettext -- --with-gettext=/usr/local/Cellar/gettext/0.19.8.1
Note: For VVV (Ubuntu), since apt-get updates the system packages, this would simply be:
phpbrew --debug install 7.2.10 +default +soap +pdo +mysql +openssl
Now wait 5-10 minutes...then after it is finished:
phpbrew switch 7.2.10
phpbrew clean 7.2.10
I'd suggest leaving at least one other earlier version, in case you need to switch away from the very latest for any reason.
phpbrew list
phpbrew remove 7.2.7
phpbrew ext install xdebug