Created
July 30, 2012 18:11
-
-
Save torifat/3208787 to your computer and use it in GitHub Desktop.
a php switching utillity for homebrew
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
#!/bin/bash | |
# php switch for homebrew | |
# $ brew tap josegonzalez/php && brew install php53 --with-mysql && brew install php54 --with-mysql | |
# Might as well ask for password up-front, right? | |
sudo -v | |
VERSION_FILE="$( cd -P "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/php-switch.version" | |
if [[ ! -f $VERSION_FILE ]]; then | |
echo "5.4" > $VERSION_FILE | |
fi | |
version=`cat $VERSION_FILE` | |
if [[ $version == 5.3 ]]; then | |
ln -sf `brew list php54 | grep libphp` /usr/local/lib/libphp5.so | |
echo "Switched to 5.4" | |
echo `brew info php54 | head -1` | |
echo "5.4" > $VERSION_FILE | |
else | |
ln -sf `brew list php53 | grep libphp` /usr/local/lib/libphp5.so | |
echo "Switched to 5.3" | |
echo `brew info php53 | head -1` | |
echo "5.3" > $VERSION_FILE | |
fi | |
sudo apachectl restart |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment