Tuesday, November 9, 2021

how to change php version in ubuntu for apache

In this tutorial we will show you how to change php version.
My current php version is 8.0 and I want 7.1

 

Step 1) Check current PHP Version

$ php -v


 

Step 2) Downgrade Current PHP version

$ sudo a2dismod php8.0


 

Step 3) Upgrade Desired PHP version Ex: 7.1

Note :- before running below command Check Desired PHP version  is already installed in your system or not "  ls /etc/php  "

$ sudo a2enmod php7.1


 

Step 4) Set php version as well for Command Line

$ sudo update-alternatives --set php /usr/bin/php7.1


 

Step 5) Restart apache service for new changes

$ sudo service apache2 restart 


 

Step 6) Now check new PHP version

$ php -v  

  or 

http://localhost/info.php



No comments:

Post a Comment

testing