A PHP error names the file and line but not the calls that led there
Your error
Fatal error: Maximum execution time of 30 seconds exceeded in /var/www/app/src/Report.php on line 882 more lines it can showFix it fast
Most common cause, 1 of 3PHP 8.4 or older never adds a backtrace to fatal errors
Move the application to PHP 8.5 or 8.6; both branches are in active support, and the directive is on by default there.
# after the upgrade, on the server
php -vShort answer
A PHP Fatal error or Warning without Stack trace lines shows where code failed but not what called it. PHP 8.4 and older never add a backtrace to fatal errors; 8.5 and later do while fatal_error_backtraces is 1, its default. Warnings and notices never carry one, so convert them to ErrorException with set_error_handler(). Applies to PHP 8.2-8.6.
Which cause do you have?
Put this into check-trace.php under the document root, open it once in a browser and remove it again. It asks the PHP that serves the failing requests for its version and the backtrace setting, since the CLI may run another build. false means this PHP does not know the directive (8.4 or older), "0" means it was switched off, and "1" means fatal errors are covered and the untraced line is a warning or notice.
<?php
var_dump(PHP_VERSION, ini_get('fatal_error_backtraces'));Then find the line you see in this list and open its fix:
- 1PHP 8.4 or older never adds a backtrace to fatal errors
PHP_VERSION is 8.4.x or lower and ini_get('fatal_error_backtraces') returns false - 2PHP 8.5 or later, but fatal_error_backtraces is set to 0
ini_get('fatal_error_backtraces') returns "0" in the web process - 3The untraced line is a warning, notice or deprecation
The line starts with PHP Warning, PHP Notice or PHP Deprecated, on any PHP version
What does the error look like?
Fatal error: Maximum execution time of 30 seconds exceeded in /var/www/app/src/Report.php on line 88Warning: unserialize(): Error at offset 0 of 11 bytes in /var/www/app/src/Cache.php on line 16The log line ends at on line N, with no Stack trace: block under it
Cause 1 of 3
PHP 8.4 or older never adds a backtrace to fatal errors
You seePHP_VERSION is 8.4.x or lower and ini_get('fatal_error_backtraces') returns false
Check
A fatal error with no trace is normal before PHP 8.5. The fatal_error_backtraces directive exists only from 8.5, whose migration notes say fatal errors such as an exceeded maximum execution time now include a backtrace. Older releases print the message, the file and the line, and nothing more. ini_get() returns false for a directive the running PHP does not have.
php -r 'var_dump(PHP_VERSION, ini_get("fatal_error_backtraces"));'Fix
Move the application to PHP 8.5 or 8.6; both branches are in active support, and the directive is on by default there. Until then, the related shutdown-function page shows how to at least log the fatal error reliably.
# after the upgrade, on the server
php -vVerify
On 8.5 or later the time-limit error is followed by a backtrace that names spin().
php -d max_execution_time=1 -r 'function spin() { while (true) {} } spin();'Confirmed by php.net
Cause 2 of 3
PHP 8.5 or later, but fatal_error_backtraces is set to 0
You seeini_get('fatal_error_backtraces') returns "0" in the web process
Check
On 8.5 and 8.6 the directive defaults to 1 and covers E_ERROR, E_CORE_ERROR, E_COMPILE_ERROR, E_USER_ERROR, E_RECOVERABLE_ERROR and E_PARSE. A value of 0 means a php.ini, an FPM pool, a .user.ini file or the application itself (the directive is INI_ALL) turned it off. That can be deliberate: the PHP security advisory for CVE-2026-109619 tells 8.5 installations that cannot update yet to set fatal_error_backtraces=0.
php --ini
grep -rn "fatal_error_backtraces" /etc/php/ 2>/dev/nullFix
First update PHP to a release that fixes CVE-2026-109619 if the 0 came from that advisory. Then set the directive back to 1 in the configuration the web server loads, and keep display_errors off in production so the trace goes to the log, never into a page.
; php.ini or pool configuration
fatal_error_backtraces = 1
display_errors = Off
log_errors = OnVerify
After restarting PHP, the first-step script prints string(1) "1".
curl -s https://example.com/check-trace.phpConfirmed by php.net
Cause 3 of 3
The untraced line is a warning, notice or deprecation
You seeThe line starts with PHP Warning, PHP Notice or PHP Deprecated, on any PHP version
Check
Only fatal error types get a backtrace from fatal_error_backtraces. A warning such as the unserialize() one above logs the file and line of the failing statement, which is often inside a shared helper called from many places. The manual's ErrorException example turns such errors into exceptions, and an uncaught exception prints the full Stack trace.
php -r 'var_dump(ini_get("error_log"));'
grep -c "Warning" /path/to/php-error.logFix
Register an error handler that throws ErrorException, as the manual shows, in development and CI first. It skips levels excluded by error_reporting() and leaves deprecations alone, so new deprecations do not break the app.
<?php
set_error_handler(function (int $errno, string $errstr, string $errfile, int $errline) {
if (!(error_reporting() & $errno)) {
return false;
}
if ($errno === E_DEPRECATED || $errno === E_USER_DEPRECATED) {
return false;
}
throw new \ErrorException($errstr, 0, $errno, $errfile, $errline);
});Verify
The same warning now appears as Uncaught ErrorException followed by Stack trace: and numbered frames (#0, #1 ...).
php -r 'set_error_handler(fn($n, $s, $f, $l) => throw new ErrorException($s, 0, $n, $f, $l)); $a = []; echo $a["id"];'Confirmed by php.net
How do I stop it coming back?
- Run development and CI on the same PHP minor as production, and on 8.5 or later, so fatal errors come with their call path.
- Enable the ErrorException handler in the test suite, where a warning should fail the build instead of scrolling past.
- Keep display_errors off and log_errors on in production, so traces reach the log and never a visitor.
Sources
How was this page made?
I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.
Which stack is behind this page?
Projects of mine on the same stack: Spotless Laundry, EZ Estimater.