I'm trying to have my page output it's < head > + some body stuff, and send it to the browser.
Then make some long mysql queries and output the rest of the page.
This works perfectly as long as I don't gzip the content.
Example:
A simplified example of the code I use which works:
<?php
ini_set('output_buffering', 'on');
echo "head..wait 3 secs</br>";
ob_flush();
flush();
sleep(3);
echo 'tail';
?>
See it live here but no gzip
or what I'm trying to get working:
<?php
ini_set('output_buffering', 'on');
ini_set('zlib.output_compression', 'On');
echo "head...wait 3 secs</br>";
ob_flush();
flush();
sleep(3);
echo 'bar';
?>
Which doesn't work see: here
I need this to work in my application but not on all pages (some don't need gzip or are libraries which handle it them selves, caldav library for example), so I prefer a php solution rather than enabling deflate application wide with .htaccess
What can I do to make flushing gzipped content work?