How to Change CLI PHP on CyberPanel?

< All Topics

CyberPanel only install LiteSpeed PHPs from LiteSpeed repos. Installation directory for PHP is located at


You need to replace XX in the path above with PHP version, for example the path for PHP version 7.4 is /usr/local/lsws/lsphp74

And PHP CLI binary path for each PHP version is


So PHP binary path for PHP 7.4 is /usr/local/lsws/lsphp74/bin/php

During installation CyberPanel installation code runs following command to set Global PHP CLI:

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

Which means by default the Global PHP for CLI is 7.4, upon running php -v on command line you will get:

[email protected]:~# php -v
PHP 7.4.16 (cli) (built: Mar  4 2021 16:36:45) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
    with Zend OPcache v7.4.16, Copyright (c), by Zend Technologies
[email protected]:~#

How you can change the default version of PHP on CLI?

If you have certain needs and PHP 7.4 does not work for certain application you can run following command to update the default PHP on CLI.

Set Command line to PHP 8.0

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

Set Command line to PHP 7.3

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

Set Command line to PHP 7.2

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

Set Command line to PHP 7.1

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

How to use specific PHP Version in your Cron Jobs?

Some applications requires you to set cron jobs and they require PHP CLI executable. Now rather then changing default global php binary version, you can use direct path to that CLI.

For example an application requires that its script should be running through PHP 7.2, you can use the direct path for its binary rather then updating a global binary, such as

/usr/local/lsws/lsphp71/bin/php <your command goes here>
Previous PHP 8.0
Table of Contents