Skip to content

Instantly share code, notes, and snippets.

@ianmustafa
Last active July 22, 2017 03:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ianmustafa/8f86f83d0df142eec76eebcbb6c964b0 to your computer and use it in GitHub Desktop.
Save ianmustafa/8f86f83d0df142eec76eebcbb6c964b0 to your computer and use it in GitHub Desktop.
Do you phpbrew?

Do you phpbrew?

By Ian Mustafa.

phpbrew builds and installs multiple version php(s) in your $HOME directory.

Install phpbrew

Follow this guide. Make sure you've meet these requirements.

Build and Install PHP

Most of the time, I build PHP with this variants.

phpbrew -d install 7.0.21 +default +mysql +sqlite +pdo +debug +exif +iconv +intl +mcrypt +session

PHP 7.1

As Mcrypt extension has been deprecated in PHP 7.1 in favour of OpenSSL, you may remove +mcrypt variant when building.

phpbrew -d install 7.1.7 +default +mysql +sqlite +pdo +debug +exif +iconv +intl +session

PHP 7.2

As of late July 2017, PHP 7.2 is available as Beta 1. You can install it from the GitHub tag.

phpbrew -d install github:php/php-src@PHP-7.2 as php-7.2.0-beta +default +mysql +sqlite +pdo +debug +exif +iconv +intl +session +fpm

Please note for macOS users, you may need to install bison and valgrind with brew and link bison with brew link.

Post-installation

Image processing extensions like GD and Imagick aren't added by default. So we can add them using ext option. Please note that those flags in GD installation command are required to enable the FreeType Support (please change the directory accordingly).

phpbrew ext install gd -- --enable-gd-native-ttf --with-freetype-dir=/usr/local/opt/freetype/include/freetype2/
phpbrew ext install imagick

Wiki and Cookbook

phpbrew has a nice wiki andcookbook. Go check out!

Troubleshooting

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