Error message
PHP: Maximum execution time of 30 seconds exceeded
A script ran longer than max_execution_time. PHP stops it with a fatal error, and the Sentry SDK still manages to send it. The limit is 30 seconds under a web server by default and none on the command line, so this error mostly hits web requests, queued work run over HTTP and imports started from a page.
Examples run on 21 November 2026 with PHP 8.6.0, sentry/sentry 4.17.1, 4.27.0 and 4.38.0, and Laravel 13.43.0 with sentry/sentry-laravel 4.31.0. Errilo is in private beta.
What the message says
A loop that never ends, with the limit lowered to 2 seconds so the example is quick:
<?php
// timeout.php, run with: php timeout.php
ini_set('max_execution_time', '2');
function crunch(): void {
while (true) { md5(random_bytes(16)); } // line 5: CPU work, never ends
}
crunch();Fatal error: Maximum execution time of 2 seconds exceeded in /app/timeout.php on line 18
Stack trace:
#0 /app/timeout.php(18): random_bytes(16)
#1 /app/timeout.php(20): crunch()
#2 {main}- The number in the message is the limit in force. With the default of the PHP built-in web server, our Laravel route stopped after 30.04 seconds and answered 500 with the message
Maximum execution time of 30 seconds exceeded. On the command line,max_execution_timeis0: no limit. - It is a fatal error, not an exception: no
catchruns, and the line reported is wherever the script was when time ran out, not the cause. - Our PHP build is a ZTS one, and there the limit counts elapsed time: a
sleep(5)with a limit of 2 seconds ended with the same error, on thesleepline. The PHP manual says that on Linux the limit counts only the CPU time of the script, so waiting for a database or an HTTP call wouldn’t count. We could not check that: we had no non-ZTS PHP build.
Fatal error: Maximum execution time of 2 seconds exceeded in /app/timeout.php on line 9
Stack trace:
#0 /app/timeout.php(9): sleep(5)
#1 {main}Fixes
- Find what is slow: the frame on the error is where time ran out, so start from the request in the event, then look for the slow query, the missing index or the external call without a timeout.
- Move the long work out of the request: a queue worker or a command, where there is no limit by default.
- Work in batches and restart the counter with
set_time_limit()in each one, when the work has to stay in a request. Five batches of one second, with a limit of 2: withoutset_time_limit(), the script stopped during batch 2; with it, all five ran. - Raise
max_execution_timeonly as a last resort, and remember that a proxy or a web server has its own timeout.
<?php
// Five batches of about one second of work, with max_execution_time = 2
ini_set('max_execution_time', '2');
foreach (range(1, 5) as $batch) {
set_time_limit(2); // restarts the counter: each batch gets its own 2 seconds
$until = microtime(true) + 1;
while (microtime(true) < $until) { md5(random_bytes(16)); }
echo "batch $batch done\n";
}What the PHP SDK captures
The timeout is a fatal error, so the fatal error listener of the SDK sends it from its shutdown function. In our runs the script was already stopped and the event still arrived, in plain PHP and in Laravel after the 30 seconds. With plain sentry/sentry:
- Level
fatal, exception typeSentry\Exception\FatalErrorException, valueError: Maximum execution time of 2 seconds exceeded(the SDK adds the prefix), unhandled. - In 4.17.1 and 4.27.0, one frame: the file and line, no function.
- In 4.38.0, the call stack: PHP 8.5 and later give the SDK a backtrace for fatal errors and 4.38.0 uses it. For the loop above, three frames: the main script,
crunch, and the internal functionrandom_bytes.
With Laravel 13.43.0 and sentry/sentry-laravel 4.31.0, the error goes through Laravel’s handler: type Symfony\Component\ErrorHandler\Error\FatalError, message Maximum execution time of 30 seconds exceeded, no level, the request attached, one frame (the line of the route).
When something outside PHP kills the process, nothing is sent. We ran a busy loop with no PHP limit and sent it a SIGKILL after 3 seconds: exit code 137, no event at all. A supervisor or a proxy that kills slow requests produces the same silence, but we did not test PHP-FPM’s request_terminate_timeout or a particular proxy.
The setup is in the Laravel guide. We did not run this error on Symfony; the Symfony guide covers the setup.
How Errilo shows it
The issue is titled with the type and message (Sentry\Exception\FatalErrorException: Error: Maximum execution time of 2 seconds exceeded), unhandled, level Fatal with the plain SDK and Error with Laravel. With 4.38.0 the location is the innermost frame of your code; with the one-frame versions, the file.
Errilo groups on the exception type and the frames. We ran its grouping code on our events: the limit in the message doesn’t matter, but with the one-frame versions, a timeout and a memory error that end in the same file get the same fingerprint, so they land in one issue. We saw it with the Laravel events of both errors, in routes/web.php. With 4.38.0 and its call stack, a timeout groups by the path of calls instead.