Re: On register_shutdown_function: What might be the problem?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Given it's a fatal error, it's as bad as a syntax error. It cancels
everything it's doing and leaves.

Remember that, even the shutdown function has to obey the time limit. 

On 7/22/05, Liang ZHONG <little00wofl@xxxxxxxxxxx> wrote:
> <?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.
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
>

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux