About PHP

Last modified: September 26, 2024


Overview

The PHP scripting language is often used for applications and content on websites. EasyApache allows you to easily install and modify PHP for your web server.

When you install cPanel & WHM, the installation process automatically installs PHP with some common PHP options.

For more information about PHP, read PHP’s documentation.

How EasyApache handles PHP

cPanel & WHM configures your Apache® web server with PHP by default. It installs the CGI PHP handler to handle requests that it receives for PHP content.

Note:
The PHP handler that you select affects the speed and security of your web server. For more information, read our PHP Handlers documentation.

PHP versions

The cPanel default profile includes PHP versions 8.1 and 8.2. You can install additional PHP versions with WHM’s EasyApache 4 interface (WHM » Home » Software » EasyApache 4).

EasyApache 4 supports PHP version 7.4 and PHP 8.1 through 8.3.

When the PHP development team releases a new version of PHP, 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.

For more information on the PHP versions and extensions available in EasyApache 4, read our PHP Options documentation.

PHP support timeline

EasyApache 4 adheres to the php.net supported versions timeline. The profiles that we supply in WHM’s EasyApache 4 interface (WHM » Home » Software » EasyApache 4) only provide PHP versions that php.net currently supports.

Packages for unsupported versions of PHP will remain on the WebPros International, LLC mirrors and servers, but we will not provide any further updates.

MultiPHP

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 (WHM » Home » Software » MultiPHP Manager).

If the version of PHP that you wish to use does not exist on your server, you can install it in WHM’s EasyApache 4 interface (WHM » Home » Software » EasyApache 4). You can also use a package manager to install PHP. For more information, read our How to Locate and Install a PHP Version or Extension documentation.

Vendor-provided PHP versions

EasyApache 4 allows you to use PHP versions that WebPros International, LLC does not provide on non-Ubuntu systems. These PHP versions must be a Software Collection Library (SCL) package and cannot start with the ea- prefix that EasyApache 4 uses.

  • You cannot use the EasyApache 4 interface (WHM » Home » Software » EasyApache 4) to install vendor-provided versions of PHP. You must use a package manager to install these packages on your system. For more information, read our Package Manager Basics documentation.
  • After you install the packages, you can use WHM’s MultiPHP Manager interface (WHM » Home » Software » MultiPHP Manager) and WHM’s MultiPHP INI Editor interface (WHM » Home » Software » MultiPHP INI Editor) to make changes.
Important:
  • The DSO PHP handler is not available with rh- and alt- PHP packages.
  • cPanel & WHM does not support DSO on PHP 8.0 and higher.
  • PHP packages require a vendor prefix in order to install in EasyApache 4.
  • Not all vendor-provided PHP packages will contain all of the files that EasyApache 4’s MultiPHP system requires. You may experience additional limitations.

Modify PHP

You can use several methods to modify your PHP configuration.

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 — /usr/local/bin/ea-php##, where ## represents the two-digit PHP version.
  • PHP CGI — /usr/bin/ea-php## command, where ## represents the two-digit PHP version.

To more easily allow you to install PECL and PEAR extensions, we provide the following symlinks:

  • PECL — /usr/bin/ea-php##-pecl, where ## represents the two-digit PHP version.
  • PEAR — /usr/bin/ea-php##-pear, where ## represents the two-digit PHP version.

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.

Adjust configuration files

To further customize your PHP configuration, you can edit your .ini files. Each version of PHP that you install uses a separate php.ini file. Each file exists in the /opt/cpanel/ea-php##/root/etc/php.ini path, where ## is the PHP version number.

We strongly recommend that you only edit your configuration files with cPanel’s MultiPHP INI Editor interface (cPanel » Home » Software » MultiPHP INI Editor). To edit your files manually, adjust the following PHP handler files in your document root:

PHP security

To ensure that your PHP version stays up to date and secure, we strongly recommend that you update your packages whenever we release a new EasyApache update. You can use one of the following methods:

  • Set the Operating System Package Updates section of WHM’s Update Preferences interface (WHM » Home » Server Configuration » Update Preferences) to Automatic.
  • As a user with root-level privileges, use your package manager to update your system’s packages manually or with a cron job.

For more information about PHP security, read our PHP Security Concepts documentation.

Additional Documentation