php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #11546 Register_Shutdown_Function doesn't happen after shutdown
Submitted: 2001-06-18 21:28 UTC Modified: 2003-02-28 00:50 UTC
Votes:3
Avg. Score:5.0 ± 0.0
Reproduced:3 of 3 (100.0%)
Same Version:2 (66.7%)
Same OS:2 (66.7%)
From: btanner at home dot com Assigned:
Status: Not a bug Package: Scripting Engine problem
PHP Version: 4.0.5 OS: Windows 2000
Private report: No CVE-ID: None
 [2001-06-18 21:28 UTC] btanner at home dot com
In theory (at least IMHO), this function should be used to register
functions to finish up after the client has detached from the server.

This way, time consuming tasks like logging, closing connections, sending
e-mail, or whatever can be done *after* the client is happily surfing to
their next page.

However, I have tested Register_Shutdown_Function as much as I can locally,
and no matter what I try... I have to wait until my shutdown functions are
done before I see the page, get redirected, or whatever.

This is bug or a feature?  Or am I a dummy?

This example should execute and be done... but instead it waits around till the shutdown function is finished.  I used sleep cause its a good way to kill time, but it happens with any time consuming operation (sending 5 emails through SMTP for example)

Example:

<?
Register_ShutDown_Function("KillTime");
print("We're DONE here.");
flush();
exit();

function KillTime(){
   sleep(30);
}
?>

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-06-19 14:23 UTC] sniper@php.net
This works for me just fine within Linux.
Also on Windows ME (PHP as Apache DSO).

What is the SAPI you are using? Web server?
Or is it run as CGI?

--Jani

 [2001-06-19 14:34 UTC] btanner at home dot com
Windows 2000 - Apache 1.3x

PHP 4.05

Running PHP.exe as CGI.  Is this the problem?
 [2001-06-21 14:05 UTC] sniper@php.net
I can now reproduce the same symptom. 
If PHP is as CGI under Apache, the example script
doesn't work. But as DSO it works.


 [2002-09-11 11:45 UTC] Xuefer at 21cn dot com
same problem under php4.2.0 win binary build with apache
the data is exactly sent after flush()

"I have to wait until my shutdown functions are done before I see the page"
not 100% true, it's ie problem.
ie will only show page after X bytes(unkown to me) of data, or page finished

the truth is: php/apache still holding connection until shutdown_functions done
 [2002-09-11 11:48 UTC] Xuefer at 21cn dot com
sorry for my bad version desc
-> php4.2.0 win binary build with apache
should be wrote as: php4.2.0 Win, run as Apache module
 [2003-02-28 00:50 UTC] sniper@php.net
Please do not submit the same bug more than once. An existing
bug report already describes this very problem. Even if you feel
that your issue is somewhat different, the resolution is likely
to be the same. Because of this, we hope you add your comments
to the existing bug instead.

Thank you for your interest in PHP.

See bug #20447

 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Mar 28 19:01:29 2024 UTC