Skip to content

Instantly share code, notes, and snippets.

@acodeninja
Created August 18, 2018 18:51
Show Gist options
  • Save acodeninja/aecf0deae71bd52f662e0e9bc6485915 to your computer and use it in GitHub Desktop.
Save acodeninja/aecf0deae71bd52f662e0e9bc6485915 to your computer and use it in GitHub Desktop.
A small script to switch php versions inside of homestead
VERSION=$1
if [ "$(which php${VERSION})" != "" ]; then
sudo update-alternatives --set php /usr/bin/php$VERSION
sudo update-alternatives --set phar /usr/bin/phar$VERSION
sudo update-alternatives --set phar.phar /usr/bin/phar.phar$VERSION
sudo update-alternatives --set phpize /usr/bin/phpize$VERSION
sudo update-alternatives --set php-config /usr/bin/php-config$VERSION
echo "Switched to php$VERSION successfully"
else
echo "Could not find php$VERSION"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment