Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I can't tell if this is going to help with your problem since buffering problems can happen even if not using gzip (zlib).</p> <p><strong>Firstly</strong> it may be that apache has deflate module (mod_deflate or mod_gzip) loaded:<br> You can try to disable it for current script like this:</p> <pre><code>apache_setenv('no-gzip', 1); </code></pre> <p><strong>Secondly</strong> it may be that browser is using internal buffer for response (around 1kB is common for IE, newer Firefox and WebKit browsers, but some browsers may have more or less).<br> That could be solved by echoing at least 1kb of blanks like this example:</p> <pre><code>echo str_repeat(' ', 1024); </code></pre> <p>Note that when using zlib, echoing 1kb of blanks (uncompressed) and flushing will not trigger these browsers to parse and render any content until ~1kb of compressed data is received.</p> <p><strong>Thirdly</strong>, if using sessions (either explicit in script or via php.ini <code>session.auto_start</code>) you need to close the session in order for output to be sent:</p> <pre><code>session_write_close(); </code></pre> <p>I assume your problem is with browser buffer and zlib. You may need to create more than 1kb of compressed data for browser to render it.</p> <p>-- I had tried myself to create flushing with zlib and believe me that is a lots of text to render just for the browser to start processing, at the end i had to echo an image file (which is already compressed) in order for it to work.</p> <pre><code>ini_set('output_buffering', 'On'); //ini_set('implicit_flush', 'On'); ini_set('zlib.output_compression', 'On'); // by default 4kB //ini_set('zlib.output_compression_level', 1); echo "head...wait 3 secs&lt;/br&gt;\n"; echo str_repeat("\n ", 500); // this is enought to work fine without zlib echo '&lt;span style="display:none"&gt;'; readfile('path/to/an/image/file.png'); // around 8kB (4kB should be enough) echo '&lt;/span&gt;'; ob_flush(); flush(); sleep(3); echo 'bar'; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload