PHP-FPM on cPanel runs one pool per account, isolated from the others. Each pool has its own pm.max_children, pm.start_servers, and so on. The defaults from cPanel’s MultiPHP Manager are conservative — 25 max children, 5 start — which is fine for a brochure site and miserable for a busy WooCommerce shop. Getting the sizing right is the difference between fast responses and 502 Bad Gateway when traffic spikes.
What’s happening
Each PHP-FPM child handles one request at a time. If pm.max_children is 25 and 30 visitors arrive simultaneously, five of them queue (or get 502s, depending on pm.max_requests and the Apache/LiteSpeed proxy settings). The right number depends on three things: how much RAM each child uses (typically 30-80 MB for WordPress, 100+ for Laravel with cached vendor), how slow each request is, and the LVE PMEM limit for the account. You cannot run 50 workers in an LVE with 1 GB of PMEM if each worker holds 80 MB.
The other knob: pm mode. dynamic (the default) keeps a buffer of idle workers ready. ondemand only spawns when needed — slower first response but lower idle RAM. For a busy site, dynamic is right; for a brochure with sporadic traffic, ondemand saves RAM.
How to verify
For a specific cPanel user, locate the pool config:
ls /opt/cpanel/ea-php82/root/etc/php-fpm.d/<username>.conf
grep -E 'pm\.|memory_limit' /opt/cpanel/ea-php82/root/etc/php-fpm.d/<username>.conf
Then check the live pool status (must be enabled in the pool config):
curl -s http://127.0.0.1/status?json | jq .
ps auxf | grep "<username>: pool"
The status output shows active processes, idle processes, listen queue, and max children reached. If max children reached is non-zero, the pool was saturated at least once — and listen queue shows how many requests had to wait.
The fix
A workable starting formula per pool:
- Measure memory per child.
ps auxfwhile the pool is under load; look at the RSS ofphp-fpm: pool <user>processes. For a WP site with common plugins, 40-60 MB is normal; for WooCommerce with WPML, 80-120 MB. - Compute the cap from LVE PMEM. If the account has 2 GB PMEM and each child needs 60 MB, the absolute cap is ~30. Set
pm.max_children=25to leave headroom. - Pick
pmmode. Dynamic for sites with continuous traffic, ondemand for sites that get hit a few times a day. - Set
pm.max_requests=500. Workers recycle every 500 requests, which protects against memory leaks in plugin code. - Set
pm.process_idle_timeout=10s. Idle workers free their memory faster, helpful on LVE-tight accounts.
Apply through whmapi1 set_php_fpm_pool or by editing the pool config and restarting PHP-FPM. Re-check status?json an hour later: max children reached should still be zero under normal load. Stack Harbor tunes pools per workload as part of managed cPanel operations.