Community

Closed Change PHP CLI version

fl
fliva #1

How do I change the default version of PHP used via console?

mu
muttahir #2

You can use this format to run your PHP scripts

/usr/local/lsws/lsphp74/bin/php /path/to/your.php

Replace lsphp74 with lsphp73 or any other version you need

fl
fliva #3

Yes but how to use PHP 7.4 as default php alias?

mu
muttahir #4

Find the current location of PHP, assuming its in /usr/bin
Modify symbolic link
ln -s /usr/bin/php /usr/local/lsws/lsphp74/bin/php

fl
fliva #5

Great

I think Cyberpanel is a great panel but it lack a lot of documentation like this.

A lot of things are done like black magic

fl
fliva #6

There’s always the fear that something set up by Cyberpanel will break…

Ni
NickW #7

@muttahir I’m interested in your symlink solution. Php -v in the console says my Php version is 7.1.33-3+bionic (cli) and I would like to change to 7.2.x and I see that /usr/local/lsws/lsphp72 does exist on the server, and I note above you say to modify symbolic link:

ln -s /usr/bin/php /usr/local/lsws/lsphp72/bin/php

Will there be an existing symlink pointing to the lsphp71 directory, and if so where might I find it please? Your help would be much appreciated (I have limited knowledge of symlinks).

Ni
NickW #8

I solved it using:
cp /usr/local/lsws/lsphp72/bin/php /usr/bin/

Ma
Master3395 #9

Type your comment> @NickW said:

I solved it using:
cp /usr/local/lsws/lsphp72/bin/php /usr/bin/

This worked for me also!

Ma
Master3395 #10

I think there should be a separate tab for PHP CLI version under
/managephp/editPHPConfigs

That would save a lot of people from having to go all SSH on it all the time.

This topic is closed to new replies.