How to enable and customize PHP-FPM directives/pool for a domain or server wide :: cPanel

What is PHP-FPM?

PHP FastCGI Process Manager (PHP-FPM) is an alternative FastCGI daemon for PHP that makes a website capable of handling strenuous loads. By setting specific amounts of resources, it even allows a host to process a domain’s requests. To accomplish this, the PHP-FPM maintains “pools” (workers available to respond to PHP requests) where these “pools” of workers allow the website to handle more requests than it normally could.

PHP-FPM is faster 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 like ruid2+php-dso does. This method is useful when a user receives extra traffic that requires resources to process it. For example, your website may receive a spike in traffic after a TV show features it or is linked from a popular website.

How to install PHP-FPM?

cPanel supports PHP-FPM with the help of EasyApache 4 and Multi-PHP manager. You can check the Multi-PHP manager to see if the PHP-FPM is installed or enabled on the server. If the required packages are not enabled, you can directly install them from Multi-PHP manager itself. You may install them using yum too.


yum install ea-php54-php-fpm ea-php55-php-fpm ea-php56-php-fpm ea-php70-php-fpm ea-php71-php-fpm ea-apache24-mod_proxy_fcgi

How to customize Pool values?

Once you have installed the necessary package through EasyApache 4, you can enable PHP-FPM to accounts using Multi-PHP manager. However, you will only be able to edit the pool values per domain basis and only a few directives through the Multi-PHP manager. There will be cases where you have a large number of accounts on the server and a default value of directive is very low (Default value for pm.max_children is 5). Then you need to customize the cPanel template and use it to generate pool configuration for all the domains.

Set a domain’s pool options

Go to Multi-PHP manager and Click ‘Pool Options’ next to your desired domain. The system will display the available options and their defaults and limits. Enter your desired options for Max Children, Process Idle Timeout (s), and Max Requests. Click Save.

How to customize PHP-FPM values server-wide?

The system uses the following configuration files to implement PHP-FPM:

/var/cpanel/ApachePHPFPM/system.yaml : This file contains system level settings.
/var/cpanel/ApachePHPFPM/system_pool_defaults.yaml: The system uses this file to generate each domain’s pool.

You can use the following as an example.

A complete configuration directive line would resemble the following example:

php_value_open_basedir: { name: ‘php_value[open_basedir]’, value: “[% documentroot %]” }

Once you have made the changes you will need to run the rebuild command to apply the same to all the domains.

If you require help, contact SupportPRO Server Admin

Server not running properly? Get A FREE Server Checkup By Expert Server Admins - $125 Value

Leave a Reply