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
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
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
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
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
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
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
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
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
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.
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;
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
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
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
14 matches
Mail list logo