Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

wturrell's avatar

App suddenly freezing due to maximum exec time error in Symfony

I ran apt-get update & upgrade remotely on a Debian server (Debian 11.2, site running PHP 8, latest Laravel 8.80.0) on a Laravel app that's generally stable.

Suddenly, for most pages, it hangs and I'm getting:

[2022-01-22 15:39:52] production.ERROR: Maximum execution time of 60 seconds exceeded {"userId":1,"exception":"[object] (Symfony\Component\ErrorHandler\Error\FatalError(code: 0): Maximum execution time of 60 seconds exceeded at /var/www/[redacted]/vendor/symfony/polyfill-mbstring/Mbstring.php:635)
[stacktrace]
#0 {main}
"}

(it had previously been 30 seconds so I upped that, but these are routes that should load almost instantly…)

The stacktrace (including on screen if APP_DEBUG=true) is ALWAYS empty.

That line of code in Mbstring.php is:

return (string) \iconv_substr($s, $start, $length, $encoding);

If I dump the contents of $s before it I get all kinds of output including environment variables and bits of code.

I have:

  • run a composer update
  • run a composer self-update
  • cleared cache, done a dump-autoload
  • restarted services
  • check the MariaDB database is OK (the tables seem fine…)
  • checked all Debian packages are up to date (also ran apt-get check)
  • rebooted server

Other things on the server, including a WordPress install running same PHP version, seem fine. (don't have

Anyone seen anything like this before?

Some pages do load ok. They still involve DB access. My next hope is to start going through the ones that don't line by line and see if I can track it down, but if you have a better idea…

(Thanks)

0 likes
6 replies
wturrell's avatar
wturrell
OP
Best Answer
Level 3

SOLVED

(Hopefully this is useful to someone else one day…)

Thanks to https://stackoverflow.com/a/66018565/763419 - what I didn't realise was that particular Symfony code being called is a sign that the PHP mbstring package is unavailable.

So I then did dpkg -l | grep 'mbstring'

ii  php-mbstring                                  2:8.1+92+0~20220117.43+debian11~1.gbpe0d14e                               all          MBSTRING module for PHP [default]
ii  php7.0-mbstring                               7.0.33-57+0~20211119.61+debian11~1.gbp5d8ba5                              amd64        MBSTRING module for PHP
ii  php7.2-mbstring                               7.2.34-28+0~20211119.67+debian11~1.gbpf24e81                              amd64        MBSTRING module for PHP
ii  php7.3-mbstring                               7.3.33-1+0~20211119.91+debian11~1.gbp618351                               amd64        MBSTRING module for PHP
ii  php7.4-mbstring                               7.4.27-1+0~20211220.57+debian11~1.gbp832572                               amd64        MBSTRING module for PHP
rc  php8.0-mbstring                               8.0.13-1+0~20211122.27+debian11~1.gbp1675bc                               amd64        MBSTRING module for PHP
ii  php8.1-mbstring                               8.1.1-1+0~20211220.11+debian11~1.gbp519568                                amd64        MBSTRING module for PHP

Debian has, for some reason, removed it, fixed with:

sudo apt-get install php8.0-mbstring

3 likes
sirfootball's avatar

The sudo apt-get install php8.0-mbstring solution also solved for me ... though I had change it to php8.3-mbstring

What a scary error. Glad I stumbled on it before my site goes live.

ifran's avatar

I come from the future to thank you.

I am using WSL with PHP 7.3 and PHP 8.2, in the switches between them, it crashed here

1 like
tgebert's avatar

I created an account just to thank you !

This saved my day.

2 likes

Please or to participate in this conversation.