Page tree
Skip to end of metadata
Go to start of metadata


The ea-php-cli package is EasyApache 4's replacement for the system-provided /usr/bin/php binary. This package automatically determines which 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 does the ea-php-cli package do?

The ea-php-cli package installs the following PHP binaries:

  • /usr/bin/php — This executable uses the php-cli binary for the specified PHP version. 

  • /usr/local/bin/php — This executable uses the php-cgi binary for the specified PHP version. 

  • /usr/bin/lsphp — This executable uses the lsphp (Litespeed) binary for the specified PHP version. 

These binaries ensure that your system uses the correct PHP handler for your request. 

How to call the ea-php-cli binaries

To call the ea-php-cli package's binaries, run the /usr/bin/php <options> filename.php command, or the /usr/local/bin/php <options> filename.php command, where filename.php represents the file that you wish to process. 

To run PHP from the command line, your command may resemble the following example:

php /home/bob/public_html/domain/app/periodic_job.php

To determine which PHP version to use, the PHP executable checks the AddType directive in the local .htaccess file. The directive may resemble the following example:

AddType application/x-httpd-ea-php54

In this example, the system will use PHP 5.4. If an .htaccess file either does not exist in the current directory or does not contain the AddType directive, the system ascends the directory tree until it finds an .htaccess file that contains the directive.

  • If the system cannot find an .htaccess file, it uses the default version of PHP.
  • If the AddType directive refers to an invalid version of PHP, the system uses the default version of PHP. 
  • If the system finds two or more identical AddType directives for a PHP handler, it uses the configuration that loads first

Override the default ea-php-cli behavior

If you want to override the file's configured version of PHP, use the -ea_php ## option, where ## represents the two-digit PHP version. Your command might resemble the following example:

 /usr/bin/php -ea_php 56 filename.php


You can also use the /usr/bin/ea-php## symlink, where ## represents the two-digit PHP version, instead of the -ea_php flag to call your desired PHP binary directly. For more information, read our PHP Home documentation.


The -ea_php option overrides the MultiPHP system's defined PHP settings. If you use this option, you may run the filename.php file with the wrong version of PHP.

The system passes all other options that you provide to the PHP binary. 

Additional customization


We strongly recommend that you do not customize your ea-php-cli installation. Most setups do not require extra configuration.

You can also perform additional customizations to your PHP setup. To perform additional customizations, create a php_cli.yaml file in the ea-php-cli executable directory. This file enables alternate MultiPHP configuration files and settings. You can use the following two options in your file:

  • ea_php_yaml — This option sets the default PHP version if you did not explicitly configure one. 
  • php_bin_pattern — This option relocates the PHP executable file. 

A customized php_cli.yaml file might resemble the following example:

ea_php_yaml: /etc/cpanel/ea4/alternate/php.conf.yaml
php_bin_pattern: /opt/alternate/ea-php%s/root/usr/bin/php 


The system replaces the %s with the correct PHP version in the above example.

In the above example, the ea-php-cli obtains the default PHP value from the /etc/cpanel/ea4/alternate/php.conf.yaml file. The /opt/alternate/ea-php70/root/usr/bin/php executable processes a filename.php file that uses PHP 7.0.

Customization with alternate versions of PHP

If your system runs cPanel & WHM version 66 or higher, you can use alternate versions of PHP.  If you use a PHP version that cPanel does not provide, the php_bin_pattern in your customized php_cli.yaml file might resemble the following example:



In the above example, the system replaces the first %s with your SCL profix, and the second %s with your PHP package's name.

What is the difference between /usr/bin/php and /usr/local/bin/php?

The /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.

The system default ea_php_yaml file 

EasyApache 4's default ea_php_yaml file exists in the  /etc/cpanel/ea4/php.conf directory . The system uses this file to determine the system's default PHP version and the PHP handler that each PHP version uses. An ea_php_yaml file might resemble the following example: 

default: ea-php56
ea-php54: cgi 
ea-php55: cgi 
ea-php56: cgi 
ea-php70: cgi 
ea-php71: suphp

If a PHP file's PHP version is not explicitly set, the system uses the default entry in the ea_php_yaml file to determine which version of PHP to use. In the above example, the system uses PHP 5.6 by default. The ea-php-cli executables do not use the handling directives of the ea-php## entries. 

If you remove the filename.php file's configured version of PHP, the ea-php-cli executable displays a warning message and uses the default version of PHP. If you remove the default PHP version, the ea_php_yaml file may become out of date and the default version of PHP will no longer exist. If both a file's configured version of PHP and the system default version of PHP are unavailable, the executable exits with an error. 

Additional documentation