user1015042
user1015042

Reputation: 21

Apache not flushing

I use a Apache 2.2.1 with PHP 5.3.8 on a Linux system.

I need to flush the header at the beginning of the call, but the browser keeps waiting until the full content is delivered.

On the command line, using "php test.php" everything works as expected but not as soon as apache is involved.

I tried everything. Setting the output_buffer=Off, zlib.output_compression=Off, disabled mod_deflate, SendBufferSize 512. I used all the different flush methods in php also. But as i said, on the command line it works fine.

Here is the response header:

I removed every module, except for these:

I hope there is someone who can help me

Upvotes: 2

Views: 1070

Answers (2)

wiktor
wiktor

Reputation: 1637

You should try send the page with another content-type or without content-type. In our server we had similar issue and we found out that mod_security blocks the flush when the content-type is html.

Upvotes: 0

Jon
Jon

Reputation: 437376

In all probability Apache is flushing just fine, but it's the browser the decides to continue buffering (and not starting render) for some time even after the initial flushed data has been received.

From the documentation:

flush() may not be able to override the buffering scheme of your web server and it has no effect on any client-side buffering in the browser.

There's nothing really you can do about that apart from browser-specific hacks such as sending lots of whitespace (I had to resort to that several years ago) to make the browser "reconsider".

Upvotes: 1

Related Questions