spacer.png, 0 kB
spacer.png, 0 kB
Home arrow PHP arrow PHP: script time-out management
PHP: script time-out management PDF Print E-mail
Written by Administrator   
mercoledž, 20 agosto 2008

A PHP script has a number of seconds it is allowed to run; if this limit is reached the script returns a fatal error. The default limit is 30 seconds and it can be restarted by calling the set_time_limit() function.

The way to handle this timeout limit is also very interesting: we could in fact understand where exactly our script fails or is heavy in terms of execution time.
The following example returns the last query (presuming it has previously memorized in the global variable $LastQuery)



function debug_timeout($buffer) {
  if (eregi('Maximum execution', $buffer))
    global $LastQuery;
    $buffer = "Login timeout: last query $LastQuery";

  return $buffer;

Last Updated ( mercoledž, 20 agosto 2008 )
< Prev   Next >
spacer.png, 0 kB
spacer.png, 0 kB
spacer.png, 0 kB