Created
April 29, 2022 07:20
-
-
Save jonathanbossenger/f9d3c686b6d4efd5b3c6081f7f9aba30 to your computer and use it in GitHub Desktop.
Script to update PHP alternatives after enabling a different PHP version
This file contains 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 | |
# Get the PHP version number passed as a variable | |
PHP_VERSION=${1-''} | |
if [[ $PHP_VERSION == '' ]] | |
then | |
echo "Please pass a PHP version number." | |
exit | |
fi | |
sudo update-alternatives --set php /usr/bin/php"$PHP_VERSION" | |
sudo update-alternatives --set phar /usr/bin/phar"$PHP_VERSION" | |
sudo update-alternatives --set phar.phar /usr/bin/phar.phar"$PHP_VERSION" | |
sudo update-alternatives --set phpize /usr/bin/phpize"$PHP_VERSION" | |
sudo update-alternatives --set php-config /usr/bin/php-config"$PHP_VERSION" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment