On register_shutdown_function: What might be the problem?

From: Date: Fri, 22 Jul 2005 21:44:33 +0000
Subject: On register_shutdown_function: What might be the problem?
Groups: php.general 
Request: Send a blank email to php-general+get-219240@lists.php.net to get a copy of this message
<?php set_time_limit(0); function f(){
       $count=10000000;
       for($i=0; $i<$count; $i++){ }
       exec("touch  /tmp/ccc");
} register_shutdown_function('f'); header("Content-type: text/plain"); header("Location: y.html"); ?> When the time_limit is set to 0, the redirect page will be shown in 20 second after the file ccc is created. When the time_limit is set to 5, the redirect page will be shown in 5 second and the ccc file is not created. The error from curl command line tool is as: --------------------------------------- <br /> <b>Fatal error</b>: Maximum execution time of 5 seconds exceeded in<b>/...../y.php</b> on line <b>6</b><br /> ---------------------------------------- What might be the problem that my register shudown function can not continuously run after the main program end? What is the correct way to keep the function running after I redirect a existing page to http client and then immediately close the connection? Thank you very much for your help.

« previous php.general (#219240) next »