Skip to content

Instantly share code, notes, and snippets.

@marcobraghim
Created March 15, 2019 16:04
Show Gist options
  • Save marcobraghim/aa7f55083d99d4fb0cea0b2732a8a7f3 to your computer and use it in GitHub Desktop.
Save marcobraghim/aa7f55083d99d4fb0cea0b2732a8a7f3 to your computer and use it in GitHub Desktop.
Script para trocar a versao do PHP pelo terminal
#!/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