pm.max_children. This directive caps how many PHP worker processes the pool can spawn. If you migrated from a small server and never touched the pool config, that cap followed you to the new machine. More RAM sitting idle does not matter when PHP-FPM refuses to start more workers than the old limit allows.
Start from the error: what the 503 actually means here
proxy_read_timeout in Nginx or ProxyTimeout in Apache only delays the error; it does not fix the starvation. If you are also seeing 504s after raising max_execution_time in PHP but not the corresponding web server timeout, that is a separate but related issue covered in Raised max_execution_time but Still Getting 504? Match Nginx fastcgi_read_timeout.
Find the smoking gun in PHP-FPM logs
/var/log/php-fpm/www-error.log, /var/log/php8.x-fpm.log, or a path under /opt/ if you use cPanel's EA4 PHP packages. Check your pool config file for the error_log directive if you are unsure.
Search for this message:
BASH
grep 'max_children' /var/log/php-fpm/www-error.logTEXT
[25-Jun-2025 14:03:11] WARNING: [pool www] server reached pm.max_children setting (5), consider raising itWhy the old value followed you to the new server
/etc/php/8.x/fpm/pool.d/www.conf (Debian/Ubuntu) or /etc/php-fpm.d/www.conf (CentOS/AlmaLinux). If you used a control panel migration tool or a full disk image, the file transferred unchanged.
The key directives inside that file:
pm = dynamic— the process manager mode. Dynamic means PHP-FPM starts some workers at boot and spawns more on demand, up to a hard ceiling.pm.max_children = 5— that hard ceiling. On a 2 GB server, 5 might have been reasonable. On an 8 GB server, it wastes most of your RAM.pm.start_servers,pm.min_spare_servers,pm.max_spare_servers— these control how many idle workers PHP-FPM keeps around, but none of them can exceedmax_children.
Size max_children from actual per-process memory
BASH
ps --no-headers -o rss -C php-fpm | awk '{ sum += $1; n++ } END { print "Workers: " n; print "Avg RSS (KB): " sum/n; print "Avg RSS (MB): " sum/n/1024 }'Apply the change and verify
pm.max_children. If you are using pm = dynamic, also adjust the related directives so they make sense relative to the new ceiling:
pm.start_servers— typically set to 25 percent of max_children.pm.min_spare_servers— a small number, enough to handle idle-period requests without delay.pm.max_spare_servers— typically set to 75 percent of max_children, or equal to start_servers.
BASH
systemctl reload php8.2-fpmphp8.2-fpm with whatever service name matches your PHP version. Use systemctl list-units | grep fpm if you are unsure.
Reload, not restart. A reload lets PHP-FPM finish serving current requests before applying the new config. A restart kills active workers immediately.
After reloading, verify the new setting took effect by checking the process count under load and watching the FPM log for the max_children warning. If the warning stops appearing during traffic that previously triggered it, the fix is working.
The opposite mistake: setting max_children too high
Keep it sized correctly over time
pm.max_children. The number is not a set-and-forget value. It is a function of your current RAM and your current per-process memory use. Change either input, and the output needs to change too.