Skip to content

Instantly share code, notes, and snippets.

@AntoineTurmel
Created August 26, 2020 07:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AntoineTurmel/3db05e8bdaa7b52592b5069ccaf68681 to your computer and use it in GitHub Desktop.
Save AntoineTurmel/3db05e8bdaa7b52592b5069ccaf68681 to your computer and use it in GitHub Desktop.
Simple script to switch from a php version to another on Ubuntu
#!/bin/bash
phpver=`php -r "echo phpversion();"`
if [ "`echo $phpver | grep '7.4'`" ]; then
echo "Bascule sur PHP 5.6.x"
sudo a2dismod php7.4
sudo a2enmod php5.6
sudo update-alternatives --set php /usr/bin/php5.6
sudo service apache2 restart
fi
if [ "`echo $phpver | grep '5.6'`" ]; then
echo "Bascule sur PHP 7.4.x"
sudo a2dismod php5.6
sudo a2enmod php7.4
sudo update-alternatives --set php /usr/bin/php7.4
sudo service apache2 restart
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment