Home » Php » php – flush() doesn't work in Firefox 4

php – flush() doesn't work in Firefox 4

Posted by: admin July 12, 2020 Leave a comment


I noticed that the php flush(); doesn’t work in Firefox 4 beta 7, as it works in 3.6.12.

I recently installed firefox 4 beta 7, and the contents are not being flush immediately when flush() is called. It used to work fine in 3.6.12. Is there any thing else that could provide me with the flushing functionality.

I’ve tried


I also tried the following code at the top of the page.

@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(); }

By the way, I use php on XAMPP/Apache. Thanks.

I found that setting content type to text/plain works, but it just outputs plain text and not html content.

How to&Answers:

You’re not seeing ghosts – I’ve experienced the same difference between FF3.6 and FF4.

Here’s a work around: add an

echo str_repeat(" ", 1024);

before the output that needs to be flushed. You can put it for example in the <head>.

My theory is that FF4, like apparently IE and Safari, have a small buffer that needs to be filled before incremental rendering kicks in.


flush will function identically server-side regardless of the browser. If the client is displaying things differently, there’s not a lot you can do server-side to fix it.