How to Change CLI PHP on CyberPanel?

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


Find Out What's New: Click to Our Latest Blog

Stay up-to-date and explore our most recent blog  post to discover fresh insights, trends, and updates in your area of interest.

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:

Enhance Your CyerPanel Experience Today!

Discover a world of enhanced features and show your support for our ongoing development with CyberPanel add-ons. Elevate your experience today!
Learn More

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:

root@ip-172-31-34-208:~# 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

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>
linkedin facebook pinterest youtube rss twitter instagram facebook-blank rss-blank linkedin-blank pinterest youtube twitter instagram