$25.02

How to change PHP CLI and Apache versions on Ubuntu

Ask a question+
2

I have a project which works with php 5.6. So I installed php5.6 in my PC. But when I check php version in phpInfo() and in CLI It still 7.1. How can I swith php to that version.

andranik 200
add comment

1 Answer

6

To swith php7.1 to php5.6 you need to run this command for Apache
sudo a2dismod php7.1
sudo a2enmod php5.6
sudo service apache2 restart

and for command line you need to run.
sudo update-alternatives --set php /usr/bin/php5.6

You can check this
https://tecadmin.net/switch-between-multiple-php-version-on-ubuntu/

add comment

Your Answer