Our website is made possible by displaying online advertisements to our visitors. Please consider supporting us by whitelisting our website.

Change or set php-cli version in Ubuntu

Hey, So you also face the same issue! Hope you will get a solution here.. BOL!

Check the current PHP version.

 php –version

In my case, it is php7.1.

Now, check the excepted version that you want to set/change in folder

ls -la /usr/bin/

You will get a list of files and folders, now check the PHP folders. In my case, it is php7.1 folder

If you don’t get the folder of your desire PHP version, then you have to install it. You can check on google or let me know, I will add another article about how to install PHP in the Linux server.

Now run this command to set the PHP alternative version for cli. I am updating it to 7.1.

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


If this article helps you then you can let me know in the comment. And also you can share with your buddies. 😉


Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Wordpress Social Share Plugin powered by Ultimatelysocial