PHP CLI version is the version of PHP used to run PHP scripts in the command line interface (CLI) of your server. This version is sometimes different from the PHP version used to run PHP scripts in the web server (such as Apache or Nginx).

You can check your PHP-CLI version by running the following command:

php -v

To see all of the PHP versions available on your Nginx server, execute the following command:

find /RunCloud/Packages/php* -name php -type f

The above command will generate a list of all the PHP versions available on your server, with the absolute path for each. To use a specific version of PHP, use its absolute path instead of php.

For instance, if you want to make sure that your script is using PHP 8.2 instead of the default PHP version, then replace php with the absolute path of PHP 8.2.

In the above screenshot, we can see that the server has four different versions of PHP. When we execute the php -v command, our server uses PHP 7.4. For more information, please refer to the PHP cheat sheet.

However, when we specify the complete path (/RunCloud/Packages/php82rc/bin/php) then it uses PHP 8.2.

Changing PHP CLI Version

The PHP CLI Version can affect the functionality and compatibility of some PHP applications that rely on the CLI, such as Composer, Cron, or Supervisord.

You can change the PHP CLI version of your RunCloud server by going to the Settings page and selecting the PHP CLI version section. You will see a list of available PHP versions that are installed on your server, from which you can choose the PHP version that you want to use as the default version for the CLI by selecting it from the dropdown menu.

Note: If you have any problem running Composer or PHP in the CLI, you may need to run SSH in interactive mode. This will ensure that the correct PHP path is loaded for the CLI. To do this, you can run the command source /etc/profile.d/runcloudpath.sh in the terminal. This will load the RunCloud path settings for the CLI.

If you have any other questions or need help – please feel free to get in touch with our 24/7 support team. We’re here to help!