ID: 30301 Comment by: ger_stingray427 at yahoo dot com Reported By: phpbug at zone-mr dot ath dot cx Status: No Feedback Bug Type: IIS related Operating System: Windows 2003 Server PHP Version: 5.0.2 New Comment:
before year 2004 this function worked ? maybe we request new feature and this function works, but not as expected for us. Previous Comments: ------------------------------------------------------------------------ [2008-09-22 06:41:57] samedi at online dot de I am having exactly the same problem! (Using PHP 5.2.6) Four years and this bug does really still exist? ------------------------------------------------------------------------ [2007-06-01 16:50:14] mike at dodgeit dot com How about fixing this bug thats been open since 2004!!! ------------------------------------------------------------------------ [2007-04-19 05:14:30] benb at dpac dot tas dot gov dot au I too am experiencing this problem with Apache 2.2.4 and PHP 5.2.1 on Ubuntu. Kernel 2.6. Using a similar script to the one listed above. Connection_status() returns 0, as does connection_aborted. However I am streaming video. When streaming this amount of data, the connection does in fact hang as the image data can't make it to the client. I added a shutdown function with register_shutdown_function() to verify this though. Several minutes after my on-disk log file stops recording data being sent, the shutdown function writes a message to the same log file to say that the script has finally been terminated. So i'm assuming that apache is still trying to send data to the client even though they're no longer listening and it's the apache write_timeout that's finally killing the thread. Because the script is effectively dead in the water while waiting for data to be received by the client, i can't put in any timeout code to compensate. So i'm about to try and put a set_time_limit(10) call before each data transmission so that an output hang is (hopefully) handled after 10 seconds rather than several minutes. It would be great though if this was fixed. It would make life so much easier! ------------------------------------------------------------------------ [2007-02-13 21:02:32] akravtsov at rogers dot com I am having the same problem! I have tried everything. This has not been fixed since Oct 2004?? This is my code: <?php //ob_end_flush(); //This should make it work: set_time_limit(0); ignore_user_abort(false); error_reporting(E_ALL); ini_set("max_execution_time", "0"); $x = 0; $error = fopen("file.txt", "a"); echo "Beginning neverending loop"; //Alternate method register_shutdown_function("help"); while($x < 40) { //ob_end_clean(); //ob_start(); $xx = $x."__Connstat: ".connection_status()."Aborted? ".connection_aborted()."\r\n\r\n"; echo $xx; fwrite($error, $xx, strlen($xx)); //This is written fine. $x++; flush(); //If I include this flush, the program stops when I hit the stop button. If I don't, it doesn't stop even if I hit the stop button. sleep(1); if(connection_status() != 0 || connection_aborted()) { $msg = "QUIT"; fwrite($error, $msg, strlen($msg)); exit(); } } function help() { $f = fopen("test.txt", "a"); $m = "QUIT"; fwrite($f, $m, strlen($m)); fclose($f); exit(); } ?> ------------------------------------------------------------------------ [2006-02-08 14:30:09] phpbug at paragontech dot com Try to do a ob_end_flush(); at the top of your script. ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/30301 -- Edit this bug report at http://bugs.php.net/?id=30301&edit=1