Bug #64998 [Com]: php-cgi is buffering output
| From: | m00n dot silv3r at gmail dot com | Date: | Sun, 09 Jun 2013 04:14:11 +0000 |
| Subject: | Bug #64998 [Com]: php-cgi is buffering output | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-179444@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=64998&edit=1
ID: 64998
Comment by: m00n dot silv3r at gmail dot com
Reported by: m00n dot silv3r at gmail dot com
Summary: php-cgi is buffering output
Status: Analyzed
Type: Bug
Package: *General Issues
Operating System: Ubuntu, Centos
PHP Version: 5.4.16
Block user comment: N
Private report: N
New Comment:
No mod deflate or mod gzip is there.
Apache does not appear to be buffering the output.
This is further confirmed when debugging with telnet. When opening the page with
telnet, the output comes in chunks of 4K. This indicates that its php that is
buffering the content.
Previous Comments:
------------------------------------------------------------------------
[2013-06-09 03:47:56] rasmus@php.net
I doubt there is a bug here. Your data is likely being buffered by your web
server, most likely due to mod_deflate being enabled.
------------------------------------------------------------------------
[2013-06-09 03:08:24] m00n dot silv3r at gmail dot com
Description:
------------
Here is the program
-----------------------------------
ini_set('output_buffering', 0);
// Implicitly flush the buffer(s)
ini_set('implicit_flush', true);
ob_implicit_flush(true);
header('Content-Type: text/event-stream');
header('Cache-Control: no-cache'); // recommended to prevent caching of event
data.
//Should output step by step in realtime
for($i = 0; $i < 10; $i++)
{
echo sleep(1) . 'Ting';
ob_flush(); flush();
}
--------------------------------------
When opened in browser, it should output data in realtime, with each echo
statement. However it is outputting only after script execution completes.
Tested on Apache 2.2.22 + Php running as cgi, and with mod_fastcgi
Php CLI works as expected.
This happens on Php 5.4.x
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=64998&edit=1