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

Overview

This document explains the dependency issue between Apache and PHP-FPM child processes and the solution to ensure that PHP-FPM works effectively on your system.

Important:

This bottleneck and solution only applies to prefork systems.

The issue

Apache settings may limit the performance of your configured PHP-FPM pool options. You must configure the Apache server to handle the same or more amount of requests than the PHP-FPM server. The following example resembles a common configuration that Apache settings may limit:

  • Domain is example.tld.
  • pm_max_children pool options is set to 20.
  • Apache is set to 10 (This is the default for cPanel installations).
_is_present: 1
pm_max_children: 20
pm_max_requests: 20
StartServers: 5
<IfModule prefork.c>
MinSpareServers: 10
MaxSpareServers: 10
</IfModule>

Your configuration file may not contain Apache's default values. In this situation, if the system receives 20 requests, it immediately passes 5 to the FPM children. After the FPM children processes the requests, Apache passes the next 5 requests. You must adjust your Apache configuration to meet the requirements of a high traffic web server.

The solution

As you increase the requests for pm_max_children in WHM's PHP-FPM's Pool Options interface (Home >> Software >> MultiPHP Manager), you must match or increase those requests in WHM's Apache Configuration (Home >> Service Configuration >> Apache Configuration). In Apache Configuration, under the Global Configurations tab, adjust the Start Servers option to use the same or greater value as the PHP-FPM pm_max_children pool options.

For the example above, you would set the Start Servers option to 20

Note:

If you do not set these configurations correctly, Apache may not serve requests in a timely manner. For example, if pm_max_children is set to 20 and Apache is set to 5, PHP-FPM and Apache can only serve 5 requests at a time. Apache abides by the lowest of the two settings.

Additional documentation