ID: 34429 Comment by: ilya at cs dot msu dot su Reported By: zimage at icdsoft dot com Status: Open Bug Type: CGI related Operating System: * PHP Version: 5CVS, 4CVS (2005-09-12) New Comment:
So, here is a trivial patch, that works... Sent it to internals@lists.php.net Hope, this will close this bug. ? khext.patch Index: sapi/cgi/cgi_main.c =================================================================== RCS file: /repository/php-src/sapi/cgi/cgi_main.c,v retrieving revision 1.271 diff -u -r1.271 cgi_main.c --- sapi/cgi/cgi_main.c 3 Dec 2005 01:27:37 -0000 1.271 +++ sapi/cgi/cgi_main.c 6 Dec 2005 21:58:18 -0000 @@ -264,13 +264,15 @@ static void sapi_cgibin_flush(void *server_context) { - if (!FCGX_IsCGI()) { + int flush_result; + if (!FCGX_IsCGI()) { FCGX_Request *request = (FCGX_Request *) server_context; - if ( + flush_result = FCGX_FFlush(request->out); + if ( #ifndef PHP_WIN32 !parent && #endif - (!request || FCGX_FFlush(request->out) == -1)) { + (!request || flush_result == -1)) { php_handle_aborted_connection(); } return; Previous Comments: ------------------------------------------------------------------------ [2005-11-30 06:26:27] ilya at cs dot msu dot su I've the same problem... At the newest php, on Debian and FreeBSD, doesn't matter, using fastcgi compiled in... Any suggestions about this problem?! It is a very important bug for me, because I'd like to give webpages to users by parts, compiling them on fly!-) ------------------------------------------------------------------------ [2005-11-19 03:50:22] fabwash at hotmail dot com I have the same problem.. What I did was to send a lot of blank space to fill up the buffer: add_message($id, str_pad('',4096)); That fixed the problem but increases the bandwidth. ------------------------------------------------------------------------ [2005-10-10 15:06:16] pdxtechie at gmail dot com This would also be useful for Ajax (using, for example, the RicoAjaxEngine.) If you are unable to disable buffering, there is no way to stream XML for progress updates through Ajax. ------------------------------------------------------------------------ [2005-09-12 16:08:04] zimage at icdsoft dot com It could be also used for writing progress bars. On a random shared hosting server: locate .php |wc -l 25147 locate .php |xargs -n1 -i grep -H -e "flush *(" {} 641 So people are using it for some reason... I can see flush() used in Moveable Type, Word Press, MediaWiki and so on. ------------------------------------------------------------------------ [2005-09-12 15:49:27] [EMAIL PROTECTED] Writing such things using PHP is pretty useless IMO, but if it works with other SAPIs.. ------------------------------------------------------------------------ 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/34429 -- Edit this bug report at http://bugs.php.net/?id=34429&edit=1