A request times out at 30 seconds. Someone raises max_execution_time to 300, and it still times out at 30 seconds. The reason is that PHP timeouts are only one of four ceilings in the stack — and the most binding one is usually Apache’s proxy timeout to PHP-FPM, not PHP’s own clock. Tuning long-running PHP requires touching every layer that can cut the connection.
What’s happening
A request from the browser through Apache to PHP-FPM passes through, in order: Apache’s Timeout directive (default 60), ProxyTimeout for the proxy-to-FPM connection (default 60 in cPanel’s generated vhosts), PHP-FPM’s request_terminate_timeout (per pool, default unset), and PHP’s max_execution_time (default 30). Whichever is smallest wins. PHP’s max_execution_time only counts CPU time, not wall-clock time spent waiting for an external service — so it does not bound a slow database query the way operators assume.
How to verify
Find every layer’s current value for the account:
grep -r "ProxyTimeout\|Timeout " /etc/apache2/conf.d/userdata/ | grep example.com
cat /opt/cpanel/ea-php82/root/etc/php-fpm.d/<user>+<domain>.conf | grep -E "terminate|timeout"
cat /var/cpanel/users/<user>/php.ini 2>/dev/null
grep -E "^(max_execution_time|max_input_time)" /opt/cpanel/ea-php82/root/etc/php.ini
If any of these is lower than the duration of the request you are trying to support, that one is the binding constraint.
The fix
- Decide what the actual ceiling should be. A long Magento export might legitimately take 8 minutes; an interactive page should never take more than 30 seconds. Pick a number for the workload, not a number to suppress the symptom.
- PHP layer: WHM > MultiPHP INI Editor > Basic Mode > set
max_execution_time = 600(or whatever you decided) for the account. Reload the FPM pool. - PHP-FPM layer: edit
/opt/cpanel/ea-php82/root/etc/php-fpm.d/<user>+<domain>.confand setrequest_terminate_timeout = 660s(slightly larger thanmax_execution_timeso PHP’s clock fires first and gives a usable error). cPanel preserves these per-pool overrides if you use the WHM > MultiPHP Manager pool settings UI. - Apache layer: WHM > Apache Configuration > Include Editor > Post VirtualHost Include > add
ProxyTimeout 700for the vhost. Apache’s globalTimeoutlives at 300 by default; if you need higher, set it in Include Editor at the main config scope. - If a CDN or reverse proxy sits in front of Apache (Cloudflare’s free tier caps at 100s; an Nginx in front of Apache has its own
proxy_read_timeout), that layer’s timeout is also in play. Adjust or accept that anything longer than the CDN cap cannot finish synchronously and must be backgrounded. - After every change, run
apachectl -t && apachectl gracefulandsystemctl reload ea-php82-php-fpm. Test with a deliberately long request:curl -v https://example.com/long-runner.phpand time it.
For environments where long-running PHP needs reliable end-to-end timeouts, Stack Harbor lays out the layered timeout map as part of environment management.