Created
March 22, 2019 07:18
-
-
Save colombinis/42ea586ce4bae6041876534adbdd7160 to your computer and use it in GitHub Desktop.
Sirve para cambiar a una version de php, actualizar variables de entorno y restart apache
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 | |
| function showPHP(){ | |
| echo "Version actual de php" | |
| echo "---------------------" | |
| php -v | |
| } | |
| showPHP | |
| declare -a VERSIONES_INSTALADAS=(5.6 7.0 7.3) | |
| echo "Versiones instaladas de php" | |
| for v in "${VERSIONES_INSTALADAS[@]}" | |
| do | |
| echo "$v" | |
| done | |
| echo "ingrese version a cambiar" | |
| read VERSIONNUEVA | |
| echo "se cambiara a $VERSIONNUEVA..." | |
| #Disable all modules from apache | |
| for v in "${VERSIONES_INSTALADAS[@]}" | |
| do | |
| #echo "$v" | |
| a2dismod php$v | |
| done | |
| #enable apache php module. | |
| a2enmod php$VERSIONNUEVA | |
| #Change to specific php version | |
| update-alternatives --set php /usr/bin/php$VERSIONNUEVA | |
| update-alternatives --set phpize /usr/bin/phpize$VERSIONNUEVA | |
| update-alternatives --set php-config /usr/bin/php-config$VERSIONNUEVA | |
| #resar apache | |
| sudo service apache2 restart | |
| showPHP |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment