← ServerPilot Docs

How to Use the PHP CLI

PHP's Command Line Interface (CLI) allows you to execute PHP scripts when logged in to your server through SSH.

ServerPilot installs multiple versions of PHP on your server so there are multiple PHP executables available to run.

Each of the following commands calls the PHP CLI for a different PHP version:

For PHP 8.2:

php8.2-sp

For PHP 8.1:

php8.1-sp

For PHP 8.0:

php8.0-sp

For PHP 7.4:

php7.4-sp

For PHP 7.3:

php7.3-sp

For PHP 7.2:

php7.2-sp

For PHP 7.1:

php7.1-sp

For PHP 7.0:

php7.0-sp

For PHP 5.6:

php5.6-sp

You can also configure the PHP version used when you call just the command php.

For more information, see the PHP CLI documentation.

Heads up! Your web applications often expect to be invoked through web requests and may not work correctly when invoked from the command line. To run PHP scripts through Cron, it is often best to cron a web request to your site using curl or wget.
Last updated: June 28, 2023

Launch your first site in 5 minutes