Last active
December 2, 2020 16:22
-
-
Save webmasterMeyers/6c810fb92ae4ffaa44d824a3cc2503dd to your computer and use it in GitHub Desktop.
disable current php and enable php with passed version, usage `$ switch-php 7.4` save this in your ~/.bashrc
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
#disable current php and enable php with passed version | |
function switch-php { | |
sudo a2dismod php$(php -v | grep -o -E '[0-9.]+' -m 1 | cut -c 1-3 | head -n 1); | |
sudo a2enmod php$1; | |
sudo update-alternatives --set php /usr/bin/php$1; | |
sudo update-alternatives --set phar /usr/bin/phar$1; | |
sudo update-alternatives --set phar.phar /usr/bin/phar.phar$1; | |
sudo update-alternatives --set phpize /usr/bin/phpize$1; | |
sudo update-alternatives --set php-config /usr/bin/php-config$1; | |
sudo service apache2 restart; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment