itanzopen.com

Clear sky
24.3 °C
Frankfurt am Main

Change PHP version on Apache

Written by

in

,

You can install multiple PHP versions on your system and switch PHP version between them.

Example:

The PHP 5.6 is set as default version in your system, and you need to switch to PHP 7.2. Run the following commands to switch for Apache and command line.

sudo a2dismod php5.6
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