Change PHP CLI version — CyberPanel - WebHosting Control Panel for OpenLiteSpeed

Change PHP CLI version

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


  • 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
  • Yes but how to use PHP 7.4 as default php alias?
  • 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
  • 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
  • There's always the fear that something set up by Cyberpanel will break...
  • edited April 2020
    @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).
  • I solved it using:
    cp /usr/local/lsws/lsphp72/bin/php /usr/bin/
  • Type your comment> @NickW said:
    > I solved it using:
    > cp /usr/local/lsws/lsphp72/bin/php /usr/bin/

    This worked for me also!
Sign In or Register to comment.
CyberPanel Discord

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!