php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #15646 the flush() does not flush the output buffer
Submitted: 2002-02-20 11:45 UTC Modified: 2002-08-30 13:58 UTC
Votes:2
Avg. Score:5.0 ± 0.0
Reproduced:2 of 2 (100.0%)
Same Version:1 (50.0%)
Same OS:2 (100.0%)
From: kewl at compfort dot pl Assigned:
Status: Not a bug Package: Output Control
PHP Version: 4.1.1 OS: Windows 2000 SP2
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: kewl at compfort dot pl
New email:
PHP Version: OS:

 

 [2002-02-20 11:45 UTC] kewl at compfort dot pl
here is the code i ran with command-line version of php:

<?
$asd=0; do { printf("asd: %d\n",$asd); flush(); sleep(1); $asd++;}while ($asd<5);
?>

if it is executed on linux, it works as expected, that is it displays asd every second.
on windows though, i only see the whole output after 5 seconds.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-02-20 12:01 UTC] kewl at compfort dot pl
BTW i found one bug report regarding similar problem, but the answer blamed the webserver buffering the output. 
its not the case in this situation.
 [2002-02-21 04:55 UTC] kewl at compfort dot pl
another $0.02: i compiled PHP succesfully using cygwin environment and it works just fine.
 [2002-02-24 05:55 UTC] yohgaki@php.net
flush feature is needed to be fixed ;)
If you really need to flush, do not use output buffering. 

(Without output buffering, PHP always outputs immediately when output is issued)
 [2002-02-24 11:43 UTC] nohn@php.net
well..another thing... I have the same problem... but it's the same server (apache 1.3.23, php 4.1.1 on linux). the problem occurs in ms ie, but not in nn4 or or mozilla.

so maybe it's a browser issue
 [2002-02-24 11:44 UTC] nohn@php.net
well..another thing... I have the same problem... but it's the same server (apache 1.3.23, php 4.1.1 on linux). the problem occurs in ms ie, but not in nn4 or or mozilla.

so maybe it's a browser issue
 [2002-02-25 03:13 UTC] kewl at compfort dot pl
Well, I dont think its a browser nor http server issue - I do not use any of these (as I wrote in the original post), only the command-line version.

regards,
 [2002-04-18 15:47 UTC] norny at yahoo dot com
I don't think this is a bug, although I do think bug #16676 is a bug. The default configuration of php.ini automatically buffers 4k of output whether you called ob_start() in the script or not. Since you only have 5 bytes of output, it'll fit well within the 4k of default buffering. Instead of using plain flush(), use ob_flush(), ob_end_flush() at the start of your script, or change the amount of default buffering in your php.ini.

If ob_implicit_flush() worked right, you could use it just once at the beginning of your script. See bug #16676 for discoveries with ob.
 [2002-08-30 13:58 UTC] iliaa@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

On both Windows & Linux if output buffering is turned of the echo output will be flushed to screen every time flush() is called. If you do have output buffering enabled and you want to flush the buffer you should use ob_flush().
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Dec 27 00:01:30 2024 UTC