. Advertisement .
..3..
. Advertisement .
..4..
There is a newer version of PHP than that installed on your system, and you might want to try it. If you have a development server with an old version of PHP and other servers with a newer version of PHP, you can easily change PHP versions on Commandline ubuntu. Read on to learn more.
How Can Change PHP versions on Commandline ubuntu?
Use the Ubuntu Commandline to change PHP Versions. First, make a list of all available versions and pick one. sudo update-alternatives –config php is the command to use. After that, manually deactivate sudo a2dismod php7.1 and enable sudo a2enmod php5.6 with this command.
Approach 1: Switch Manually
Utilize the following command line if you have to utilize PHP 7.1.
sudo a2dismod php5.6
sudo a2enmod php7.1
sudo service apache2 restart
or:
sudo update-alternatives –set php /usr/bin/php7.1
sudo update-alternatives –set phar /usr/bin/phar7.1
sudo update-alternatives –set phar.phar /usr/bin/phar.phar7.1
Approach 2: Change from PHP 7.1 to PHP 5.6
Utilize the following command line if you have to utilize PHP 5.6.
sudo a2dismod php7.1
sudo a2enmod php5.6
sudo service apache2 restart
sudo update-alternatives –set php /usr/bin/php5.6
Approach 3: Interactive switching mode
sudo update-alternatives –config php
sudo update-alternatives –config phar
sudo update-alternatives –config phar.phar
Approach 4: Enable, then disable
First, make a list of all available versions and pick one.
sudo update-alternatives –config php
After that, do this manually:
sudo a2dismod php7.1 //disable
sudo a2enmod php5.6 //enable
Conclusion
Changing PHP versions on Commandline ubuntu is a confusing problem. We hope this blog has helped clear the air around how to do it. If you have more questions about this topic, please leave a comment below. Thank you for reading; we are always excited when one of our posts can provide useful information on a topic like this!
Leave a comment