I am focusing on a PHP script which creates large (multi-Megabytes) output quickly not understanding the space ahead of time. I'm writing straight to php://output via fwrite() and also have attempted both standard output and taking advantage of Transfer-Encoding: chunked (encoding the portions as needed) but regardless of what I attempt the browser waits until all of the information is written before exhibiting a download dialog. I've attempted flush()ing too following the headers and after each chunk but this does not matter.

I am speculating that Apache is caching the output because the browser would normally display after getting a couple of kB in the server.

Does anybody have ideas regarding how to stop this caching and flush the information towards the browser because it is produced?

Thanks, J

To begin with, like BlaM pointed out in the comment, if within the PHP configuration OutputBuffering is enabled, it will not work, so it might be helpful to understand your phpinfo().

Next factor, try whether it works together with a large file that's saved on yor webserver, output it usinf readfile. And, along with this, see if you signal the right headers. Hints regarding how to readfile() and send the right headers a provided here: StackOverflow: How you can pressure personal files download in PHP

And when you are in internet marketing, call doctor_finish_flush() or doctor_finish_clean() towards the top of your script.