0

I'm looking for a possibility to find out, where in the complex coding the error "Fatal error: Maximum execution time of 30 seconds exceeded" has occured. I'm interested in backtrace (call stack) of the place, where the coding was canceled. I've tried to register a shutdown function and it is called, but its backtrace doesn't point to the canceled coding. Is there an other way to find it out? Here a sample coding as demonstration, which doesn't give mie the needed information, that the cancel occured in the function fun():

<?php
set_time_limit(2);

register_shutdown_function('shutdown');

fun();

function fun()
{
  while( true )
    ; // place of cancel
}

function shutdown()
{
  debug_print_backtrace();
}
?>

the current output is:

Fatal error: Maximum execution time of 2 seconds exceeded in /var/www/html/tmp/test.php on line 13
#0 shutdown()

The current output doesn't give the information of the place and the call stack where error occured.

Thanks, Annie

Annie W.
  • 328
  • 4
  • 22
  • Does this answer your question? [Fatal error: Maximum execution time of 30 seconds exceeded](https://stackoverflow.com/questions/5164930/fatal-error-maximum-execution-time-of-30-seconds-exceeded) – Markus Zeller Nov 19 '22 at 14:12
  • Does this answer your question? [How to catch the fatal error: Maximum execution time of 30 seconds exceeded in PHP](https://stackoverflow.com/questions/6861033/how-to-catch-the-fatal-error-maximum-execution-time-of-30-seconds-exceeded-in-p) – OMi Shah Nov 19 '22 at 14:15
  • these are simmilar questions but there are no helpful answers – Annie W. Nov 19 '22 at 14:53
  • _"The current output doesn't give the information of the place and the call stack"_ - It might not give you the call stack, but isn't `/var/www/html/tmp/test.php on line 13` at least the place where it happens? – M. Eriksson Nov 19 '22 at 15:01
  • no, my problem occures in a big php file with plenty of functions, I nees a call stack or a trace of all calls but the file is not enough – Annie W. Nov 19 '22 at 15:04

0 Answers0