Skip to content

Instantly share code, notes, and snippets.

@chernjie
Created October 2, 2015 04:51
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 chernjie/adaf9dff2cd600a6ba4a to your computer and use it in GitHub Desktop.
Save chernjie/adaf9dff2cd600a6ba4a to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
function _usage()
{
echo "$0 [php53|php54|php55|php56]"
}
function phpversion()
{
local _VERSION=$1
for i in php53 php54 php55 php56
do
test "$_VERSION" = "$i" || brew unlink "$i"
done
brew link $_VERSION
case $_VERSION in
php54) brew link phpunit;;
php55) brew link phpunit;;
php56) brew link phpunit;;
esac
echo "Restarting apache..."
local libphp5=$(ls -t /usr/local/Cellar/$_VERSION/5*/libexec/apache2/libphp5.so | head -1)
sudo ln -sf $libphp5 /usr/libexec/apache2/libphp5.so
sudo apachectl -k restart
}
case $1 in
php53|3|53|5.3) phpversion php53;;
php54|4|54|5.4) phpversion php54;;
php55|5|55|5.5) phpversion php55;;
php56|6|56|5.6) phpversion php56;;
*) _usage;;
esac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment