From:             m00n dot silv3r at gmail dot com
Operating system: Ubuntu, Centos
PHP version:      5.4.16
Package:          *General Issues
Bug Type:         Bug
Bug description:php-cgi is buffering output

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 bug report at https://bugs.php.net/bug.php?id=64998&edit=1
-- 
Try a snapshot (PHP 5.4):   
https://bugs.php.net/fix.php?id=64998&r=trysnapshot54
Try a snapshot (PHP 5.3):   
https://bugs.php.net/fix.php?id=64998&r=trysnapshot53
Try a snapshot (trunk):     
https://bugs.php.net/fix.php?id=64998&r=trysnapshottrunk
Fixed in SVN:               https://bugs.php.net/fix.php?id=64998&r=fixed
Fixed in release:           https://bugs.php.net/fix.php?id=64998&r=alreadyfixed
Need backtrace:             https://bugs.php.net/fix.php?id=64998&r=needtrace
Need Reproduce Script:      https://bugs.php.net/fix.php?id=64998&r=needscript
Try newer version:          https://bugs.php.net/fix.php?id=64998&r=oldversion
Not developer issue:        https://bugs.php.net/fix.php?id=64998&r=support
Expected behavior:          https://bugs.php.net/fix.php?id=64998&r=notwrong
Not enough info:            
https://bugs.php.net/fix.php?id=64998&r=notenoughinfo
Submitted twice:            
https://bugs.php.net/fix.php?id=64998&r=submittedtwice
register_globals:           https://bugs.php.net/fix.php?id=64998&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=64998&r=php4
Daylight Savings:           https://bugs.php.net/fix.php?id=64998&r=dst
IIS Stability:              https://bugs.php.net/fix.php?id=64998&r=isapi
Install GNU Sed:            https://bugs.php.net/fix.php?id=64998&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=64998&r=float
No Zend Extensions:         https://bugs.php.net/fix.php?id=64998&r=nozend
MySQL Configuration Error:  https://bugs.php.net/fix.php?id=64998&r=mysqlcfg

Reply via email to