CyberPanel only install LiteSpeed PHPs from LiteSpeed repos. Installation directory for PHP is located at
/usr/local/lsws/lsphpXX
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
/usr/local/lsws/ls{php**}/bin/php
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:
php -v
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 -sf /usr/local/lsws/lsphp81/bin/php /usr/bin/php
Install php8.0 to LSWS
apt install lsphp81 lsphp81-common lsphp81-mysql lsphp81-dev lsphp74-curl
Set Command line to PHP 7.3
ln -s /usr/local/lsws/lsphp73/bin/php /usr/bin/php
Set Command line to PHP 7.2
ln -s /usr/local/lsws/lsphp72/bin/php /usr/bin/php
force overwrite
ln -sf /usr/local/lsws/lsphp72/bin/php /usr/bin/php
Set Command line to PHP 7.4
ln -sf /usr/local/lsws/lsphp74/bin/php /usr/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>
admin