Created
June 10, 2019 08:01
-
-
Save iamshanto/eedffa4d5d196bb42c4b781ec61d6458 to your computer and use it in GitHub Desktop.
switch-php-version
This file contains hidden or 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
#!/bin/bash | |
HEIGHT=15 | |
WIDTH=40 | |
CHOICE_HEIGHT=4 | |
BACKTITLE="PHP version switch" | |
TITLE=$BACKTITLE | |
MENU="Available PHP version" | |
OPTIONS=(1 "PHP 5.6" | |
2 "PHP 7.0" | |
3 "PHP 7.2") | |
CHOICE=$(dialog --clear \ | |
--backtitle "$BACKTITLE" \ | |
--title "$TITLE" \ | |
--menu "$MENU" \ | |
$HEIGHT $WIDTH $CHOICE_HEIGHT \ | |
"${OPTIONS[@]}" \ | |
2>&1 >/dev/tty) | |
clear | |
case $CHOICE in | |
1) | |
#sudo a2dismod php7.0 | |
#sudo a2dismod php7.2 | |
#sudo a2enmod php5.6 | |
#sudo update-alternatives --set php /usr/bin/php5.6 | |
#sudo service apache2 restart | |
sudo a2dismod php7.0 && sudo a2dismod php7.2 && sudo a2enmod php5.6 && sudo update-alternatives --set php /usr/bin/php5.6 && sudo service apache2 restart | |
echo "PHP 5.6 Enabled" | |
;; | |
2) | |
#sudo a2dismod php5.6 | |
#sudo a2dismod php7.2 | |
#sudo a2enmod php7.0 | |
#sudo update-alternatives --set php /usr/bin/php7.0 | |
#sudo service apache2 restart | |
sudo a2dismod php5.6 && sudo a2dismod php7.2 && sudo a2enmod php7.0 && sudo update-alternatives --set php /usr/bin/php7.0 && sudo service apache2 restart | |
echo "PHP 7.0 Enabled" | |
;; | |
3) | |
#sudo a2dismod php5.6 | |
#sudo a2dismod php7.0 | |
#sudo a2enmod php7.2 | |
#sudo update-alternatives --set php /usr/bin/php7.2 | |
#sudo service apache2 restart | |
sudo a2dismod php5.6 && sudo a2dismod php7.0 && sudo a2enmod php7.2 && sudo update-alternatives --set php /usr/bin/php7.2 && sudo service apache2 restart | |
echo "PHP 7.2 Enabled" | |
;; | |
esac |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment