Page 1 of 1

How to Change CLI PHP on CyberPanel?

Posted: Mon Apr 07, 2025 8:56 pm
by Kosmito
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 7.3

Code: Select all

ln -sfn /usr/local/lsws/lsphp7.3/bin/php  /usr/bin/php
Set Command line to PHP 7.4

Code: Select all

ln -sfn /usr/local/lsws/lsphp74/bin/php  /usr/bin/php
Set Command line to PHP 8.0

Code: Select all

ln -sfn /usr/local/lsws/lsphp80/bin/php  /usr/bin/php
Set Command line to PHP 8.1

Code: Select all

ln -sfn /usr/local/lsws/lsphp81/bin/php  /usr/bin/php
Set Command line to PHP 8.2

Code: Select all

ln -sfn /usr/local/lsws/lsphp82/bin/php  /usr/bin/php
we make a little test on CLI to Confirm the change with this command and the answer is going to show the version

Code: Select all

# php -v
PHP 8.2.24 (cli) (built: Sep 24 2024 22:12:40) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.2.24, Copyright (c) Zend Technologies
    with Zend OPcache v8.2.24, Copyright (c), by Zend Technologies