Skip to content

Instantly share code, notes, and snippets.

@dinukasal
Created February 3, 2019 14:10
Show Gist options
  • Save dinukasal/537ddfe55c8b8ac4b244daf3e07a3fce to your computer and use it in GitHub Desktop.
Save dinukasal/537ddfe55c8b8ac4b244daf3e07a3fce to your computer and use it in GitHub Desktop.
Bash script to switch php version between 5.6 and 7.0
echo Enter php version
echo 1: v7.0 to v5.6
echo 2: v5.6 to v7.0
echo
read v
if [[ "$v" == 1 ]]
then
echo changing php from v7.0 to v5.6
sudo a2dismod php7.0 ; sudo a2enmod php5.6 ; sudo service apache2 restart
sudo update-alternatives --set php /usr/bin/php5.6
else
echo changing php from v5.6 to v7.0
sudo a2dismod php5.6 ; sudo a2enmod php7.0 ; sudo service apache2 restart
sudo update-alternatives --set php /usr/bin/php7.0
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment