ea-php-cli package is EasyApache 4's replacement for the system-provided
/usr/bin/php binary. This package determines the PHP version that the user's application requires from the system. While the stock version of the
/usr/bin/php binary assumes a single version of PHP, cPanel & WHM's
ea-php-cli package determines the correct version of PHP to execute.
What do the
ea-php-cli packages do?
ea-php-cli package installs the following PHP binaries:
/usr/bin/php— This executable uses the
php-cgibinary for the specified PHP version.
/usr/local/bin/php— This executable uses the
php-clibinary for the specified PHP version.
When you install a PHP version, the system also installs the
ea-php-cli-lsphp package. This package contains the
/usr/bin/lsphp binary. This executable uses the
lsphp (Litespeed) binary for the specified PHP version.
ea-php-cli-lsphp package manages this binary. If you can not call this binary, you can install it manually with the following command:
These binaries ensure that your system uses the correct PHP handler for your request.
What is the difference between
/usr/bin/php binary calls the PHP CGI handler. The
/usr/local/bin/php binary calls the PHP command-line handler.
This works with most system's default
PATH settings, and ensures compatibility with EasyApache 3 behavior.
/usr/bin/lsphp binary calls the Litespeed (
This works with most system's default
PATH settings and ensures that the system correctly calls Litespeed.
You can also use
/usr/local/bin/lsphp to call this binary.
The system default
The system uses the
/etc/cpanel/ea4/php.conf file to determine the system's default PHP version and the PHP handler that each PHP version uses.
If a PHP file's PHP version is not explicitly set, the system uses the
default entry in the
file to determine which version of PHP to use.
Set the system's default PHP version and an individual domain's PHP version in WHM's MultiPHP Manager interface (WHM >> Home >> Software >> MultiPHP Manager). You can also set the system's default PHP version with the
script. For more information, read our PHP documentation.
- If you configure a file or the system with an invalid package, the executable exits with an error message.
- If you configure the file or system with a package that does not contain the necessary binary, the executable displays a warning message and uses the system default version of PHP.
- If both a file's configured version of PHP and the system default version of PHP are unavailable, the executable exits with an error.
If you manually edit the
php.conf file, your settings may not persist.
How to call the
To call the
ea-php-cli binaries, run the one of the following commands, where
filename.php represents the file that you wish to process:
/usr/bin/php <options> filename.php
/usr/local/bin/php <options> filename.php
/usr/bin/lsphp <options> filename.php
To run PHP from the command line, your command might resemble the following example:
The system uses the user's configured PHP path to determine which PHP version it calls.
The first time you call one of the
ea-php-cli binaries, the system creates the
.ea-php-cli.cache symlink to the PHP version that the directory requires. This symlink provides a quick way for the system to determine the proper version of PHP and reads as broken by design. For example, if the PHP script requires PHP 7.0, then the symlink will point to
We strongly recommend that you do not delete these symlinks. The system creates broken symlinks by design and will recreate any removed symlinks the next time that you run the script. You can safely ignore them.
Override the default
If you want to override the file's configured version of PHP, use the
/usr/bin/ea-php## symlink, where
## represents the two-digit PHP version that you wish to use. Your command might resemble the following example:
You can also use the
--ea-reference-dir=directory option to tell the system to use the PHP version set in the specified directory. Your command might resemble the following example, where
directory represents the path to the directory that you wish to reference:
We deprecated the
-ea_php option in the
ea-php-cli version 1.0.0 RPM. We will remove this option in November 2019.
The system passes all other options that you provide to the PHP binary.
For more information, read our PHP Home documentation.
There is no content with the specified labels