After searching and trying out a bit, I found out several things.
1) There might be gzip compression which is executed via the zlib library. This can be deactivated on runtime:
ini_set('zlib.output_compression', false);
2) There might additionally be gzipping applied via an Apache module. It is not possible to see, wether or not this is going to happen after code execution, but there is a pretty reliable way to break it:
header("Content-Encoding: none");
This is not standard compliant, but it forces Apache to think that the provided content can possibly not be compressed. So it won't jump in.
There might be a lot of other situations (like nginx, or another gzipping extension, and so on), but in most of the cases, this combination of tricks will do the trick:
// disable zlib
ini_set('zlib.output_compression', false);
// Force termination of all instantiated buffers
while (@ob_end_flush());
// prevent apache from gzipping
header("Content-Encoding: none");
// prevent the browsers from showing a cached version before showing the new one
header('Cache-Control: no-cache');
// Start the output to enable buffering
header('Content-Type: text/html; charset=utf-8' );
// Push the beginning of the page to the browser
ob_flush();
flush();
// Do stuff here.
Hope this helps anyone...