Some time the CLI or your server PHP version needs to change. Here in this article, we will discuss how to change Linux Server PHP version.
Welcome back! Many of you are wondering how to change the PHP CLI version. In this short article, we will be looking at this.
First, let’s check the current version of PHP. Type in the command:
php --version
As you can see, I am currently running PHP v7.4.25.
Change Linux Server PHP version
Now let’s change our PHP version but first of we need to know what other versions we can use. To know that type in the terminal:
ls /usr/local/lsws/
We have four versions available i.e PHP 7.2, 7.3 7.4, and 8.0. I will be changing it to 8.0.
Now to do that, you need to copy the binary of the version you want to use to the user’s binary. Now type in the following command:
cp /usr/local/lsws/lsphp80/bin/php /usr/bin/
Change the lsphp80 to any version you want and hit enter. After that, check the PHP version again and you’ll see the version is changed.
Read more: How to create, delete and manage Child Domains in CyberPanel?