Linux Programmer | RHCE | RHCSA

Search This Blog

Saturday, 8 June 2019

Switch between multiple PHP version in Ubuntu

If you have two php versions (e.g. PHP7.2 and PHP 5.6 ) installed in your ubuntu system.


Switch from PHP 5.6 to PHP 7.2 =====>

Apache:-
sudo a2dismod php5.6
sudo a2enmod php7.2
sudo service apache2 restart
 
Command Line:-
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  

Switch from PHP 7.2 to PHP 5.6 =====>
 
Apache:-
sudo a2dismod php7.2
sudo a2enmod php5.6
sudo service apache2 restart

Command Line:-
sudo update-alternatives --set php /usr/bin/php5.6
sudo update-alternatives --set phar /usr/bin/phar5.6
sudo update-alternatives --set phar.phar /usr/bin/phar.phar5.6
sudo update-alternatives --set phpize /usr/bin/phpize5.6
sudo update-alternatives --set php-config /usr/bin/php-config5.6
 


No comments:

Post a Comment

MIG - NVIDIA

The new Multi-Instance GPU (MIG) feature allows GPUs (starting with NVIDIA Ampere architecture) to be securely partitioned into up to seven ...