Re: On register_shutdown_function: What might be the problem?
| From: | André Medeiros | Date: | Fri, 22 Jul 2005 22:36:07 +0000 |
| Subject: | Re: On register_shutdown_function: What might be the problem? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-219241@lists.php.net to get a copy of this message | ||
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@hotmail.com> 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
>
>