#!/bin/bash CURRENT_PHP_VERSION=$(php -r "echo phpversion();"|cut -c1-3) NEW_PHP_VERSION=$1 a2dismod php$CURRENT_PHP_VERSION a2enmod php$NEW_PHP_VERSION service apache2 restart update-alternatives --set php /usr/bin/php$NEW_PHP_VERSION #update-alternatives --set php-fpm /usr/bin/php$NEW_PHP_VERSION-fpm #update-alternatives --set phar /usr/bin/phar$NEW_PHP_VERSION #update-alternatives --set phar.phar /usr/bin/phar.phar$NEW_PHP_VERSION #update-alternatives --set phpize /usr/bin/phpize$NEW_PHP_VERSION #update-alternatives --set php-config /usr/bin/php-config$NEW_PHP_VERSION