Warning: Redis::get(): php_network_getaddresses: getaddrinfo for localhost failed: Name or service not known in /home/solveddoc.com/public_html/wp-content/plugins/litespeed-cache/src/object-cache.cls.php on line 674 version Archives - Solveddoc
How to Change PHP CLI Version
Welcome back! Many of you are wondering how to change 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 PHP CLI 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.