# cPanel PHP-FPM Tuning: “Server Reached pm.max_children” Fix

Source: https://srvscripts.com/guides/apache-php-fpm-cpanel-php-fpm-tuning/
Updated: 2026-10-06
Publisher: srvScripts (https://srvscripts.com/)

PHP-FPM is the default PHP handler on new cPanel installs, but the defaults it ships with are conservative and most servers still have a handful of sites running under the old suPHP or LSAPI handlers from earlier migrations. Getting real performance from it means matching the pool sizes to memory, picking an MPM that suits FPM, and enabling OPcache properly. The steps below apply to EasyApache 4 on cPanel 134 and 138 with PHP 8.2 to 8.4.

In short: Convert every account to PHP-FPM with /scripts/php_fpm_config –convert_all, switch Apache to the event MPM once no site uses mod_php, and keep the sum of pm.max_children across all pools within the RAM left after MariaDB and the OS…

**Short answer:** Convert every account to PHP-FPM with `/scripts/php_fpm_config --convert_all`, switch Apache to the event MPM once no site uses mod_php, and keep the sum of `pm.max_children` across all pools within the RAM left after MariaDB and the OS, divided by the average worker size. Then install the OPcache package for each PHP version and give it around 256 MB of shared memory. Confirm with `httpd -V` and an FPM error log that shows no new max_children warnings.

## Switch the handler and confirm the MPM

Check what each PHP version is currently using:

```
whmapi1 php_get_handlers
whmapi1 php_get_vhosts_by_version version=ea-php84
```

Turn PHP-FPM on for every site in one go from **WHM » Software » MultiPHP Manager » System PHP-FPM**, or from the shell:

```
whmapi1 php_set_default_accounts_to_fpm default_accounts_to_fpm=1
/scripts/php_fpm_config --convert_all
```

PHP-FPM works with any of the three Apache MPMs, but the choice matters. `prefork` is the safe legacy option and is required if you still run `mod_php`. Once everything is on FPM there is no reason to keep it: switch to `event`, which handles keep-alive connections without holding a full process per idle client. In EasyApache 4, select the `ea-apache24-mod_mpm_event` package and deselect `mod_mpm_prefork`; the provision step restarts Apache. Confirm with:

```
httpd -V | grep -i mpm
```

If you use LiteSpeed Enterprise instead of Apache, the MPM section does not apply, but the FPM pool sizing below still does when LiteSpeed is configured to use FPM rather than its own LSAPI.

## Size pm.max_children from memory, not guesswork

cPanel assigns each account its own FPM pool, so the total worker count across all pools is what you must keep within RAM. The formula is simple: measure the average resident size of a PHP-FPM worker, subtract what MySQL, Apache, mail and the OS need, and divide.

```
ps -ylC php-fpm --sort:rss | awk '{sum+=$8; n++} END {print sum/n/1024 " MB average"}'
free -m
```

On a typical WordPress-heavy server a worker sits between 40 and 90 MB. With 16 GB of RAM, MariaDB taking 4 GB and 2 GB reserved for everything else, you have about 10 GB for PHP, which is roughly 130 workers at 75 MB each. That is the ceiling for the sum of `pm.max_children` across all pools, not per pool.

cPanel’s pool defaults are set at the system level under **MultiPHP Manager » System PHP-FPM Configuration** (`pm.max_children`, `pm.max_requests`, `pm.process_idle_timeout`). The defaults are `pm = ondemand`, `max_children = 5`, idle timeout 10 seconds. `ondemand` is correct for shared hosting because idle pools consume nothing. For the small number of busy sites, raise the pool value per domain in **MultiPHP Manager » PHP-FPM settings** for that domain, or write a YAML override:

```
cat > /var/cpanel/userdata/USERNAME/example.com.php-fpm.yaml
