What the message looks like
[29-Oct-2026 10:14:52] WARNING: [pool www] server reached pm.max_children setting (5), consider raising itCommon causes
- Slow scripts keep workers busy for long: a slow database query, a slow external API, a lock.
- A burst of traffic or bots hits uncached PHP pages.
pm.max_childrenis simply too low for the normal load of this server.- The value was raised too far in the past and PHP now exhausts RAM, so workers get killed instead (check the OOM page).
- Long-running requests such as exports or imports block workers.
Check
- Active pool settings (without comments)
grep -hE '^(pm|pm\.[a-z_]+) *=' /etc/php/*/fpm/pool.d/*.conf - How often did the pool hit the limit?
- Average memory per PHP-FPM worker
ps -eo rss,cmd | awk '/[p]hp-fpm: pool/ {s+=$1; n++} END {if (n) print n " workers, " s/n/1024 " MB average"}' - Free memory on the server
free -m
Fix
- Size the pool from memory:
pm.max_children= RAM you can give to PHP divided by the average worker size from the check above. - Set it in the pool file under
/etc/php/<version>/fpm/pool.d/www.conf, together with matchingpm.start_servers,pm.min_spare_serversandpm.max_spare_serversforpm = dynamic. - Find the slow requests: set
request_slowlog_timeout = 5sandslowlog = /var/log/php-fpm-slow.login the pool, then read the stack traces. - Reduce the load: cache pages, block abusive bots, move long jobs out of web requests.
- Restart the PHP-FPM service of your version, then watch the log for the warning.
FAQ
Can I just set a very high pm.max_children?
No. Each worker uses memory. If the total exceeds RAM, the kernel kills processes or the server swaps, which is worse than queued requests.
Which pm mode should I use?
dynamic is a good default. ondemand saves RAM on idle servers but is slower on first requests, static is for busy servers with predictable memory.