#30301 [Com]: connection_status and connection_aborted not working.

From: Date: Tue, 13 Feb 2007 21:02:44 +0000
Subject: #30301 [Com]: connection_status and connection_aborted not working.
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-108827@lists.php.net to get a copy of this message
ID: 30301 Comment by: akravtsov at rogers 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: 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(); } ?> Previous Comments: ------------------------------------------------------------------------ [2006-02-08 14:30:09] phpbug at paragontech dot com Try to do a ob_end_flush(); at the top of your script. ------------------------------------------------------------------------ [2005-10-18 22:16:29] ecarpenter at itex dot co dot za I am having the same problem on SuSE Linux 9.3 running Linux 2.6.11.4-21.9-default, Apache 2.0.53 and PHP 4.3.10 (cli) (built: Aug 31 2005 16:14:46) The script below can be used to recreate the problem. After I have press the Stop button (Firefox 1.0.7) the script continues to execute until it is killed 15 minutes later without the shutdown function being executed. <? function foo() { exec("echo '".date("Y/m/d H:i:s")." Terminating Status:".connection_status()."' >> /tmp/test"); } register_shutdown_function('foo'); exec("echo '".date("Y/m/d H:i:s")." Starting' > /tmp/test"); $count=0; while (true) { $count++; exec("echo '".date("Y/m/d H:i:s")." Running ".$count." Status:".connection_status()."' >> /tmp/test"); } ?> ------------------------------------------------------------------------ [2005-10-11 10:51:26] klimov at mmk dot ru I have tried PHP 4.4.0 and 5.0.5 and latest cvs. My server is running on Windows 2003 with IIS 6. The functions connection_aborted and connection_status doesn't work properly too. ------------------------------------------------------------------------ [2005-03-15 01:00:14] php-bugs at lists dot php dot net No feedback was provided for this bug for over a week, so it is being suspended automatically. If you are able to provide the information that was originally requested, please do so and change the status of the bug back to "Open". ------------------------------------------------------------------------ [2005-03-07 22:06:04] sniper@php.net Please try using this CVS snapshot: http://snaps.php.net/php5-latest.tar.gz For Windows: http://snaps.php.net/win32/php5-win32-latest.zip ------------------------------------------------------------------------ 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

« previous php.bugs (#108827) next »