Created
September 27, 2019 21:06
-
-
Save singhhrpreet/fec44c6ff248b02076b3d8a037497a2e to your computer and use it in GitHub Desktop.
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
# > /dev/null is disable the outputs of the commands | |
if [ $# -eq 0 ]; then | |
echo "Provide the PHP version to enable" | |
exit 0 | |
fi | |
for php in 5.6 7.1 7.2 7.3 | |
do | |
if [ $php == $1 ] | |
then | |
echo "Enabling PHP v$php" | |
sudo a2enmod php${php} > /dev/null | |
fi | |
if [ $1 != $php ] | |
then | |
echo "Disabling PHP v$php" | |
sudo a2dismod php${php} > /dev/null | |
fi | |
done | |
echo "Restarting Apache Server.." | |
sudo service apache2 restart | |
echo "Done.. My Friend.." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
If you have multiple PHP versions installed in your linux system.
And you need to enable a certain version and disable others.
Eg.
phpswitcher 7.1
would enable 7.1 and disable all others and also restart apache web server