Annie W.
Annie W.

Reputation: 448

php 'Maximum execution time' analyse place of processing

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

Upvotes: 1

Views: 50

Answers (0)

Related Questions