Created
October 29, 2013 13:53
-
-
Save scottrobertson/7215083 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
function switch_php { | |
NEW_VERSION="php$1" | |
EXISTS=`brew info $NEW_VERSION >> /dev/null 2>&1` | |
if [ ! $? -eq 0 ] | |
then | |
echo "PHP Version does not exist" | |
return 1 | |
fi | |
echo 'Unlinking other versions' | |
brew unlink php53 > /dev/null && | |
brew unlink php54 > /dev/null && | |
brew unlink php55 > /dev/null | |
echo 'Linking new version' | |
brew link $NEW_VERSION > /dev/null | |
echo 'Restarting PHP-FPM' | |
service php restart > /dev/null | |
echo "Switched to $NEW_VERSION" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment