title: Flushing HTML to Browser using PHP
body: <p>I am trying to implement the trick listed on this page <a href="http://developer.yahoo.com/performance/rules.html#flush" rel="nofollow noreferrer">http://developer.yahoo.com/performance/rules.html#flush</a> "Flush the Buffer Early".</p>
  
  <p>Everytime I try to run this thing I am not getting the desired output.</p>
  
  <p>I have written the following code.</p>
  
  <pre><code>&lt;html&gt;
  &lt;head&gt;
      &lt;title&gt;This is title&lt;/title&gt;
      &lt;script type="text/javascript" src="/1.js"&gt;&lt;/script&gt;
      &lt;link rel="stylesheet" type="text/css" href="/1.css"&gt;
  &lt;/head&gt;
  
  &lt;body&gt;
  ABC
  &lt;?php
  flush();
  sleep(3);
  ?&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>The result <img src="https://i.stack.imgur.com/1hPi5.png" alt="enter image description here"></p>
  
  <p>I am getting the same result on both Firefox and Chrome.</p>
  
  <p>What I expect is that the download of CSS and JS files should start immediately, and not wait for 3 seconds.</p>
  
  <p>Based on the information given on the internet, I have tried the following things but nothing has helped.</p>
  
  <pre><code>1. ob_start(); and then ob_flush();
  
  2. Using both ob_flush(); and flush(); ( in both the orders )
  
  3. Adding the thing like this
  @apache_setenv('no-gzip', 1);
  @ini_set('zlib.output_compression', 0);
  @ini_set('implicit_flush', 1);
  
  4. Putting more content in body 4~5 KB of content before flush.
  
  5. And many other things.
  </code></pre>
  
  <p>I doubt if achieving this kind of thing is actually possible.</p>