Created
September 10, 2016 16:02
-
-
Save indrisepos/ac3964f8f57b0a22be0938e0588c3dd8 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
| #!/bin/bash | |
| # | |
| # @see http://askubuntu.com/questions/761713/how-can-i-downgrade-from-php-7-to-php-5-6-on-ubuntu-16-04 | |
| # | |
| # Installation: Download this file and move it to the /usr/local/bin directory | |
| # | |
| if [ ! -x "$(find /usr/bin -maxdepth 1 -name 'php5*' -print -quit)" ]; then | |
| echo "PHP 5 not exist!" | |
| exit 1 | |
| fi | |
| if [ ! -x "$(find /usr/bin -maxdepth 1 -name 'php7*' -print -quit)" ]; then | |
| echo "PHP 7 not exist!" | |
| exit 1 | |
| fi | |
| case "$1" in | |
| 5) | |
| echo 5 | |
| # For php in web apps | |
| sudo a2dismod php7.0 && sudo a2enmod php5.6 && sudo service apache2 restart | |
| # For php-cli in the command line | |
| sudo ln -sfn /usr/bin/php5.6 /etc/alternatives/php | |
| php -v | |
| ;; | |
| 7) | |
| echo 7 | |
| # For php in web apps | |
| sudo a2dismod php5.6 && sudo a2enmod php7.0 && sudo service apache2 restart | |
| # For php-cli in the command line | |
| sudo ln -sfn /usr/bin/php7.0 /etc/alternatives/php | |
| php -v | |
| ;; | |
| *) | |
| echo $"Usage: phpsw {5|7}" | |
| exit 1 | |
| esac |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment