Created
March 15, 2019 16:04
-
-
Save marcobraghim/aa7f55083d99d4fb0cea0b2732a8a7f3 to your computer and use it in GitHub Desktop.
Script para trocar a versao do PHP pelo terminal
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 | |
# Colors | |
y='\e[33m' # Yellow | |
d='\e[39m' # Default color | |
# Avoid root user | |
user=$(whoami); | |
if [ "$user" != "root" ]; then | |
echo -e "This script require ${y}sudo${d}" | |
exit 1 | |
fi | |
update-alternatives --config php | |
curver=$(php --run 'echo substr(phpversion(), 0, 3);'); | |
a2dismod php* | |
a2enmod "php"$curver | |
# Pega com o usuario a versao a ser habilitada | |
# echo -e "Which version of PHP would you like to enable?" | |
# read -r newPhp | |
# a2enmod $newPhp | |
service apache2 restart |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment