Re: [PHP] On register_shutdown_function: What might be the problem?

2005-07-26 Thread Liang ZHONG
Hi Rasmus, This may be a little bit long, sorry for taking your time. It still does not work as expected. I tried some experiment, and found that if I called some function or write some code line other then calling header(), the register_shutdown_function and other part of codes work as

Re: [PHP] On register_shutdown_function: What might be the problem?

2005-07-26 Thread Rasmus Lerdorf
I really didn't follow all that. But this stuff is not that complex. header() sets a header to be sent when output goes out. header() does not send an actual header at that point. If you don't send any output, then the headers won't go out until the script terminates. If you have any sort of

Re: [PHP] On register_shutdown_function: What might be the problem?

2005-07-26 Thread Rasmus Lerdorf
That's a client-side issue then, because it is certainly sent. Trying your exact script: ?php ignore_user_abort(true); header(Location: redirect2.html); echo foo\n; flush(); for($i=0;$i10;$i++) { echo $i; sleep(1); } $fp = fopen(/tmp/foo.txt,a); fputs($fp,$i); fclose($fp); ? It's at

Re: [PHP] On register_shutdown_function: What might be the problem?

2005-07-26 Thread Liang ZHONG
Thank you for replying. Sorry for being long again. I tried your suggestion of this: ?php ignore_user_abort(true); header(Location: redirect2.html); echo foo\n; flush(); for($i=0;$i10;$i++) { echo $i; sleep(1); } $fp = fopen(/tmp/foo.txt,a); fputs($fp,$i); fclose($fp); ? The browser did not get

Re: [PHP] On register_shutdown_function: What might be the problem?

2005-07-26 Thread Liang ZHONG
I tested the link (http://lerdorf.com/red.php) using browser (firefox 1.0), it worked as expected, the page of redirect2.html displayed within 2 seconds. I put the exact code to my testing envirionment (2 places), as this one: http://liang.ns2user.info/php/red.php , and the page shows up in

Re: [PHP] On register_shutdown_function: What might be the problem?

2005-07-26 Thread Rasmus Lerdorf
Liang ZHONG wrote: The php configuration is: http://liang.ns2user.info/php/info.php. I have no read permission of those httpd.conf files so do not know how apache configured. That shows PHP is running as a CGI. As a CGI PHP has very little control over anything. It is completely at the mercy

Re: [PHP] On register_shutdown_function: What might be the problem?

2005-07-26 Thread Liang ZHONG
Sorry for bothering again, but I did not mention the other environment on which I tested, since it has an access control to outsider. I saved the info page to: http://liang.ns2user.info/php/info-train06.htm. The php runing on as apache 2.0 filter module. And the resutl of the experiment is

Re: [PHP] On register_shutdown_function: What might be the problem?

2005-07-26 Thread Rasmus Lerdorf
I have no experience with the Apache2 filter. On the few servers I use Apache2 on I use the handler SAPI and it works fine there as far as I can tell. lerdorf.com is running Apache-1.3 with the standard PHP Apache1 SAPI. No special setup on it. I have no idea why your Perl thing is doing

Re: [PHP] On register_shutdown_function: What might be the problem?

2005-07-23 Thread Liang ZHONG
I think I did not express myself clearly. What I want is to be able to redirect user an existing page (let them get it immediately), and to close the connection actively, NOT passively by user abort, at last, to run the function in background. But the redirecting using function header() with

Re: [PHP] On register_shutdown_function: What might be the problem?

2005-07-23 Thread Rasmus Lerdorf
If you don't flush some output after setting the header() then the headers won't go out until the end of the request. So do something like: ignore_user_abort(true); header(Location: http://whatever;); echo foo\n; flush(); Then whatever comes after this should run and the browser is long gone.

Re: [PHP] On register_shutdown_function: What might be the problem?

2005-07-22 Thread André Medeiros
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 [EMAIL PROTECTED] wrote: ?php set_time_limit(0); function f(){ $count=1000;

Re: [PHP] On register_shutdown_function: What might be the problem?

2005-07-22 Thread Liang ZHONG
I want the http client see the page ( here y.html) immediately after I call header function, and then close the connectiion, and the function f running in the background. But trying many many times, the result seems that I have to either set the time limit to small to send the the html page

Re: [PHP] On register_shutdown_function: What might be the problem?

2005-07-22 Thread Jasper Bryant-Greene
Liang ZHONG wrote: What is the correct way to keep the function running after I redirect an existing page to http client (which I want the client get immediately) and then immediately close the connection? Use the execution functions to call an external script that performs the tasks you

Re: [PHP] On register_shutdown_function: What might be the problem?

2005-07-22 Thread Rasmus Lerdorf
Liang ZHONG wrote: My Question is: What is the correct way to keep the function running after I redirect an existing page to http client (which I want the client get immediately) and then immediately close the connection? ignore_user_abort(true); -Rasmus -- PHP General Mailing List