PHP is a scripting language that websites often use for applications and content. EasyApache allows you to easily install and modify PHP for your server.
When you install cPanel & WHM, the installation process automatically installs PHP with some common PHP options.
For more information about the PHP scripting language, read the PHP development website.
How Apache handles PHP
By default, cPanel & WHM configures your Apache web server to use the CGI handler to handle requests that it receives for PHP content.
The PHP handler that you select affects the speed and security of your web server. For more information about PHP handlers, read our PHP Handlers documentation.
EasyApache 4 supports PHP versions 5.4, 5.5, 5.6, 7.0, and 7.1.
When the PHP development team makes a new version of PHP available, we test and then make the new version available in EasyApache.
Minor version number changes do not impact functionality, but major updates may require changes to your configuration. In many cases, the EasyApache software will make the necessary adjustments automatically. Custom configurations may require further manual adjustments. For more information on PHP versions and extensions available in EasyApache 4, read our PHP Options documentation.
EasyApache 4 supports multiple versions of PHP.
To change your server's default version of PHP or a virtual host's version of PHP, use WHM's MultiPHP Manager interface (Home >> Software >> MultiPHP Manager).
If the version of PHP that you wish to use does not exist on your server, you can install it with the EasyApache 4 interface (Home >> Software >> EasyApache 4). To install your PHP version with yum, read our How to Locate and Install a PHP Version or Extension documentation.
Vendor-provided PHP versions
ea-prefix used by EasyApache 4.
You cannot use the EasyApache 4 interface (Home >> Software >> EasyApache 4) to install vendor-provided versions of PHP. You must use yum to install these packages on your system. For more information, read our Yellowdog Updater, Modified (yum) Basics documentation.
After you install the packages, you can use WHM's MultiPHP Manager interface (Home >> Software >> MultiPHP Manager) and WHM's MultiPHP INI Editor interface (Home >> Software >> MultiPHP INI Editor) to make changes.
- The DSO PHP handler is not available with RedHat Linux Enterprise Linux® (RHEL) and CloudLinux™ PHP packages.
- SCL PHP packages require a vendor prefix to install in EasyApache 4. For example, you cannot use RHEL PHP versions 5.4 or 5.5, as these packages do not begin with a vendor prefix.
- Not all vendor-provided PHP packages will contain all of the files that EasyApache 4's MultiPHP system requires. You may experience additional limitations.
Some potential issues exist with vendor-provided versions of PHP.
Vendor-provided php.ini does not exist
In some cases, a vendor-provided PHP version's
php.ini file will not exist in the directory that cPanel & WHM requires. For example, RHEL's php56
.ini file exists in the
/opt/rh/rh-php56/register.content/etc/opt/rh/rh-php56 directory, but cPanel expects it in the
/opt/rh/rh-php56/root/etc directory. You must create a symlink in order for the MultiPHP system to read the
php.ini file. To create the symlink, use the following command, where
php56 represents the PHP version you wish to use:
If you installed the PHP version before you created the symlink, you must reinstall the PHP version with the following command, where
php56 represents the PHP version that you wish to use:
PHP CLI and PHP CGI binaries in different locations
Some PHP versions include the PHP CLI and PHP CLI binaries in different locations than cPanel & WHM's implementation. In these cases, the PHP installation reverses the location of these binaries. If your PHP version does this, then the following issues may occur:
- The php-cgi binary path will not exist.
- The php-cli binary path will be wrong.
To fix this issue, use the following commands, where
prefix represents the vendor prefix and
package represents the package name:
There are several methods that allow you to modify your PHP configuration. For more information, read the following documentation:
- PHP Options — A list of the available options in EasyApache that directly modify PHP.
- PHP Handlers — The PHP handler that you select determines how Apache handles requests for PHP content.
To more easily allow you to call the PHP binaries directly, we provide the following symlinks for each version of PHP installed on your system:
- PHP CLI —
##represents the two-digit PHP version.
- PHP CGI —
##represents the two-digit PHP version.
Adjust configuration files
To further customize your PHP configuration, you can edit your
.ini files. We strongly recommend that you only edit your configuration files in cPanel's MultiPHP INI Editor interface (Home >> Software >> MultiPHP INI Editor). To edit your files manually, use the following files in your document root:
|Apache handler||PHP configuration file|
If you enabled the
To ensure that your PHP stays up to date, use one of the following options:
- Set the Operating System Package Updates section of WHM's Update Preferences interface (Home >> Server Configuration >> Update Preferences) to Automatic.
- As a
root-enabled user, run
yum updateon the command line.
- Install the CentOS-provided
yum-cronpackage with the following command:
yum install yum-cron.
For more information about PHP security, read the following documentation: