Last active
August 12, 2018 15:59
-
-
Save marcialsoto/ba22f546200d85838a9a7d0f1c89836c 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
| nano /path/to/create-sh.sh | |
| #!/bin/bash | |
| chmod +x /path/to/create-sh.sh | |
| mv /path/to/create-sh.sh /usr/local/bin/create-sh |
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
| # Switch PHP versions | |
| sphp () { | |
| local IS_PHP7=`php --version|grep "PHP 7.2"` | |
| if [[ -z $IS_PHP7 ]]; then | |
| echo "Switching to PHP 7.2" | |
| sudo a2dismod php7.1 | |
| sudo a2enmod php7.2 | |
| sudo service apache2 restart | |
| sudo update-alternatives --set php /usr/bin/php7.2 | |
| sudo update-alternatives --set phar /usr/bin/phar7.2 | |
| sudo update-alternatives --set phar.phar /usr/bin/phar.phar7.2 | |
| sudo update-alternatives --set phpize /usr/bin/phpize7.2 | |
| sudo update-alternatives --set php-config /usr/bin/php-config7.2 | |
| sudo service apache2 restart | |
| php -v | |
| else | |
| echo "Switching to PHP 7.1" | |
| sudo a2dismod php7.2 | |
| sudo a2enmod php7.1 | |
| sudo service apache2 restart | |
| sudo update-alternatives --set php /usr/bin/php7.1 | |
| sudo update-alternatives --set phar /usr/bin/phar7.1 | |
| sudo update-alternatives --set phar.phar /usr/bin/phar.phar7.1 | |
| sudo update-alternatives --set phpize /usr/bin/phpize7.1 | |
| sudo update-alternatives --set php-config /usr/bin/php-config7.1 | |
| sudo service apache2 restart | |
| php -v | |
| fi | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment