Created
March 17, 2021 14:49
-
-
Save Stichoza/350b33dcbd337df88f423e764eca4a50 to your computer and use it in GitHub Desktop.
PHP version manager script for MAMP Pro
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
function pvm() { | |
if [ "$1" = "" ]; then | |
echo "Please specify PHP version to run." | |
return 1 | |
elif [ "$1" = "use" ]; then | |
if [ "$2" = "" ]; then | |
echo "Please specify a PHP version." | |
return 1 | |
elif test -f "/Applications/MAMP/bin/php/php$2/bin/php"; then | |
export PATH=/Applications/MAMP/bin/php/php$2/bin:$PATH | |
unalias php | |
echo "Using PHP $2 version." | |
return 0 | |
else | |
echo "PHP $2 is not installed." | |
return 1 | |
fi | |
elif test -f "/Applications/MAMP/bin/php/php$1/bin/php"; then | |
/Applications/MAMP/bin/php/php$1/bin/php -c "/Library/Application Support/appsolute/MAMP PRO/conf/php$1.ini" $2 | |
else | |
echo "PHP $1 is not installed." | |
return 1 | |
fi | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment