Skip to content

Instantly share code, notes, and snippets.

@Shipu
Last active August 20, 2019 18:34
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Shipu/100bc3b63c5ad58087ac017528f1d479 to your computer and use it in GitHub Desktop.
Save Shipu/100bc3b63c5ad58087ac017528f1d479 to your computer and use it in GitHub Desktop.
Switch php versions in ubuntu
echo "Enter the php version you want to Disable:"
read disabledVersion
echo "Enter the php version you want to Enable:"
read enabledVersion
sudo a2dismod php${disabledVersion}
sudo a2enmod php${enabledVersion}
sudo service apache2 restart
# or
sudo service nginx restart
sudo update-alternatives --set php /usr/bin/php${enabledVersion}
php -v
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment