PHP-FPM Code and FileSystem Layout for EasyApache 4

Last modified: July 13, 2022


This document explains the following information about the PHP FastCGI Process Manager (PHP-FPM) daemon:

  • The PHP-FPM filesystem layout.
  • How the system implements PHP-FPM on your system.

PHP-FPM provides an alternative FastCGI daemon for PHP that allows a website to handle significant loads. It allows a host to set specific amounts of resources to process a domain’s requests via workers available to respond to PHP requests (pools). These pools allow a website to process more requests.

PHP-FPM functions more quickly than traditional CGI-based methods, such as SUPHP, for multi-user PHP environments. It does not overload a system’s memory with PHP from Apache processes, such as the ruid2+php-dso process. PHP-FPM only executes PHP requests, which enables it to service content quicker than other methods.

We strongly recommend that you only activate Apache PHP-FPM if your server has at least 2 GB of RAM available, or at least 30 MB of RAM per domain. If you enable PHP-FPM on a server with less than the required RAM, your server may experience severe performance issues.

PHP-FPM implementation

The Cpanel::PHPFPM (Cpanel/ module provides the basis of EasyApache support with PHP-FPM. The module’s built-in defaults generate configuration files that provide fully functional PHP-FPM pools for a domain.

The system uses the following configuration files:

  • /var/cpanel/ApachePHPFPM/system.yaml
  • /var/cpanel/ApachePHPFPM/system_pool_defaults.yaml

You will need to create these two files manually. To do this, perform the following steps:

  1. Create the /var/cpanel/ApachePHPFPM/ directory.

    mkdir -p /var/cpanel/ApachePHPFPM/

  2. Create the two files.

    touch /var/cpanel/ApachePHPFPM/system.yaml
    touch /var/cpanel/ApachePHPFPM/system_pool_defaults.yaml

File contents

Each file contains different directives from the built-in values.

  • The system does not require these files to run because the built-in defaults enable the PHP-FPM to run sufficiently.
  • Only include the differences in directives within these files.

The following example displays the system.yaml file’s contents:

daemonize: yes
  • This example only uses a different value than the built-in default for the daemonize setting.
  • The system-pool-defaults.yaml file applies the value to each pool that you create.
  • Each domain in the system requires that you create one pool.
  • Replace any unacceptable characters such as .[]() with an underscore _.

The table below contains examples of unacceptable value names.

Old Name New Name
syslog.facility syslog_facility
php_admin_value[disable_functions] php_admin_value_disable_functions

If you prepend any PHP settings with the disable functions or disable_classes flags, the system will append the new php.ini value to the previous one in the user’s .htaccess files. For more information, read’s FastCGI Process Manager (FPM) documentation.

The filesystem configuration files

The system stores the configuration files that control PHP-FPM in the following files:

  • /opt/cpanel/ea-php80/root/etc/php-fpm.conf— This file contains the system configurations of PHP-FPM.
  • /opt/cpanel/ea-php80/root/etc/php-fpm.d/[domain].conf — This file changes your domain to the domain setting of the website that you use. For example, the cptest1.tld.conf domain.

The .yaml files within the /var/cpanel directories generate these two files.

  • Do not edit these configuration files manually.
  • The system duplicates these configuration files for each version that you select.
  • The /opt/cpanel/ea-php80/root/etc/php-fpm.d/[domain].conf file displays ea-php80 or php80 as its version.
  • You must change ea-php80 to the version on which your system currently runs. For example, if your system runs on PHP version 7.3 or 7.4, change ea-php80 to ea-php73 or ea-php74.

Required files


Use the required file /var/cpanel/userdata/[user]/[domain].php-fpm.yaml only if you wish to run PHP-FPM.

  • /var/cpanel/userdata/[user]/[domain].php-fpm.yaml — This file controls a specific domain’s pool. The system uses the built-in default values and system_pool_defaults values to generate the [domain].conf file.

Optional files


Use the following optional files only if you wish to change the default parameters. All domain pools use these defaults unless a .yaml file overrides them.

  • /var/cpanel/ApachePHPFPM/system.yaml — This file contains system level settings. The system also uses this file to generate the /opt/cpanel/ea-php5?/root/etc/php-fpm.conf file, where the ? indicates that the system uses this file to generate all of the PHP versions in the php-fpm.conf file.
  • /var/cpanel/ApachePHPFPM/system_pool_defaults.yaml — The system uses this file to generate each domain’s pool and configure each user’s pool.

    If you edit a user’s pool in WHM’s MultiPHP Manager interface (WHM » Home » Software » MultiPHP Manager), the system no longer applies the system default settings to that user.

Restore PHP to your system

The system cannot remove configurations or other related files when you manually remove packages. If you manually remove packages, you could remove dependencies that your hosted websites require.


We do not recommend that you remove any ea-php packages via your server’s package manager. If you remove PHP from your system while any of your hosted websites still use it, those websites will display errors. In addition, Apache could fail to display the website entirely. Before you remove a package, confirm that none of your hosted websites use the PHP version that you wish to remove with WHM’s MultiPHP Manager interface (WHM » Home » Software » MultiPHP Manager).

To restore PHP versions to your system, run the following commands:

ea_install_profile --install /etc/cpanel/ea4/profiles/cpanel/default.json
/usr/local/cpanel/scripts/restartsrv apache_php_fpm

If the above commands fail, contact your system administrator.

Additional Documentation