Articles

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 5.4:

php5.4-sp

For PHP 5.5:

php5.5-sp

For PHP 5.6:

php5.6-sp

For PHP 7.0:

php7.0-sp

For PHP 7.1:

php7.1-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: August 22, 2016