Jump to content

Flush not flushing!


B0b

Recommended Posts

Hey guys,

 

Apparently flush won't flush on my new server.

This will hold the buffer up to the end:

 

for ( $i = 0; $i <= 10; $i++)
{
    echo 'Foo ' . $i . ' Bar' . '<br/>';
    flush();
    wait( 1 );
}

 

Any clue of what's going on?

 

Thanks so much!

Link to comment
Share on other sites

Thank you very much for the reply.

In phpinfo, output_buffering is set to 4096.

Does that mean it output only after 4096 bytes are cached? If so, how should that be changed in a local php.ini file, if it's possible?

 

Edit: I meant sleep  ;)

Link to comment
Share on other sites

Have you read the information in the flush() section of the php documentation?

 

You must also disable all of the buffering (including the buffering being done to accomplish compression) that the web server is doing.

 

Short-answer: web servers and browsers were never intended for output from a single http request to be sent this way.

Link to comment
Share on other sites

I got it to work with one of the posts in PHP documentation:

 

@apache_setenv('no-gzip', 1);
@ini_set('zlib.output_compression', 0);
@ini_set('implicit_flush', 1);
for ($i = 0; $i < ob_get_level(); $i++) { ob_end_flush(); }
ob_implicit_flush(1);

 

All that to be able to flush  8)

 

Thanks guys.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.