[PHP] maximum execution time exceeded but !connection_timeout() ???
Hi, (PHP 4.0.3pl1 on Apache/1.3.14) I hope somebody can help me. I'm at my wit's end with this one. I need to use a shutdown function that does something only if it was called due to a connection timeout. I register a shutdown fuction and provoke a timeout; the function is called. But it sees connection_status() = 0 and connection_timeout() as false. (If I click the Stop button on the browser, my shutdown function sees connection_abort = true.) The wierd thing is that the shutdown function is not called if there is no timeout and no user abort. If I could rely on this behavior that would be fine. But that is not how PHP is meant to work so I'm not willing to rely on it. I see on the screen: Fatal error: Maximum execution time of 5 seconds exceeded But inspecting connection_status() shows it is 0 and connection_timeout() is false. Here's my test code. I made it write to a file because using sqrt() and sleep() it never timed out. ?php set_time_limit(5); ignore_user_abort(0); function done() { global $i, $fp; $u=connection_status(); fputs($fp,i reached $i, connection status = $u \n); if(connection_timeout()) fputs($fp,** the connection was timed out **\n); else fputs($fp,** not timed out **\n); if(connection_aborted()) fputs($fp,** the connection was aborted **\n); else fputs($fp,** not aborted **\n); fclose($fp); } register_shutdown_function(done); $fp = fopen(logfile.txt,w); $tempout = fopen(tempout,w); $tfile=tester.zip; for($i=0; $i40; $i++) { $temp_aray=file($tfile); while (list($key, $val) = each($temp_aray)) { fwrite($tempout,$key); fwrite($tempout,$val); } fputs($fp,i is $i\n); echo $ibr\n; } fputs($fp, main: i finishes as $i\n); fclose($tempout); fclose($fp); if(connection_timeout()) echo main ** the connection was timed out **br\n; else echo main ** not timed out **br\n; $u=connection_status(); echo connection_status = $u br\n; unlink(tempout); ? John Clements . . | \_/ [EMAIL PROTECTED] +44 (0) 20 8959-8213 29 Gibbs Green, Edgware, Middx., UK HA8 9RS -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] maximum execution time exceeded but !connection_timeout() ???
Hi, (PHP 4.0.3pl1 on Apache/1.3.14) I hope somebody can help me. I'm at my wit's end with this one. I need to use a shutdown function that does something only if it was called due to a connection timeout. I register a shutdown fuction and provoke a timeout; the function is called. But it sees connection_status() = 0 and connection_timeout() as false. (If I click the Stop button on the browser, my shutdown function sees connection_abort = true.) The wierd thing is that the shutdown function is not called if there is no timeout and no user abort. If I could rely on this behavior that would be fine. But that is not how PHP is meant to work so I'm not willing to rely on it. I see on the screen: Fatal error: Maximum execution time of 5 seconds exceeded But inspecting connection_status() shows it is 0 and connection_timeout() is false. Here's my test code. I made it write to a file because using sqrt() and sleep() it never timed out. ?php set_time_limit(5); ignore_user_abort(0); function done() { global $i, $fp; $u=connection_status(); fputs($fp,i reached $i, connection status = $u \n); if(connection_timeout()) fputs($fp,** the connection was timed out **\n); else fputs($fp,** not timed out **\n); if(connection_aborted()) fputs($fp,** the connection was aborted **\n); else fputs($fp,** not aborted **\n); fclose($fp); } register_shutdown_function(done); $fp = fopen(logfile.txt,w); $tempout = fopen(tempout,w); $tfile=tester.zip; for($i=0; $i40; $i++) { $temp_aray=file($tfile); while (list($key, $val) = each($temp_aray)) { fwrite($tempout,$key); fwrite($tempout,$val); } fputs($fp,i is $i\n); echo $ibr\n; } fputs($fp, main: i finishes as $i\n); fclose($tempout); fclose($fp); if(connection_timeout()) echo main ** the connection was timed out **br\n; else echo main ** not timed out **br\n; $u=connection_status(); echo connection_status = $u br\n; unlink(tempout); ? John Clements . . | \_/ [EMAIL PROTECTED] +44 (0) 20 8959-8213 29 Gibbs Green, Edgware, Middx., UK HA8 9RS -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]