Last active
December 23, 2015 11:59
-
-
Save corbanb/6632413 to your computer and use it in GitHub Desktop.
This will give you the ability to install multiple versions of php side by side. (via: https://coderwall.com/p/vn1iqg)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# More info - https://github.com/josegonzalez/homebrew-php#installing-multiple-versions | |
# install multiple versions of php with homebrew | |
brew tap josegonzalez/php | |
brew install php53 --with-fpm | |
brew install php54 --with-fpm | |
brew install php55 --with-fpm | |
# These are the aliases that will auto switch to the version you want to use. | |
alias use_php53="brew unlink php54 && brew unlink php55 && brew unlink php53 && brew link php53" | |
alias use_php54="brew unlink php53 && brew unlink php55 && brew unlink php54 && brew link php54" | |
alias use_php55="brew unlink php53 && brew unlink php54 && brew unlink php55 && brew link php55" | |
# Below is an extended version I use when I'm controlling FPM services via Supervisor. | |
alias use_php53="brew unlink php54 && brew unlink php55 && brew unlink php53 && brew link php53 && supervisorctl restart php5-fpm" | |
alias use_php54="brew unlink php53 && brew unlink php55 && brew unlink php54 && brew link php54 && supervisorctl restart php5-fpm" | |
alias use_php55="brew unlink php53 && brew unlink php54 && brew unlink php55 && brew link php55 && supervisorctl restart php5-fpm" | |
# also avabile is phpbrew an alternate to the above options with more complex and advanced setup | |
# https://github.com/c9s/phpbrew | |
==> Caveats | |
To enable PHP in Apache add the following to httpd.conf and restart Apache: | |
LoadModule php5_module /usr/local/opt/php54/libexec/apache2/libphp5.so | |
The php.ini file can be found in: | |
/usr/local/etc/php/5.4/php.ini | |
✩✩✩✩ PEAR ✩✩✩✩ | |
If PEAR complains about permissions, 'fix' the default PEAR permissions and config: | |
chmod -R ug+w /usr/local/Cellar/php54/5.4.19/lib/php | |
pear config-set php_ini /usr/local/etc/php/5.4/php.ini | |
✩✩✩✩ Extensions ✩✩✩✩ | |
If you are having issues with custom extension compiling, ensure that this php is | |
in your PATH: | |
PATH="$(brew --prefix josegonzalez/php/php54)/bin:$PATH" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment