title: Disabling Output Buffer with Apache and PHP-FPM via mod_proxy
body: <p>Outputting content as soon as PHP generates it is fine when using Apache with PHP as a module as you can simply disable output_buffering in PHP and use flush() or implicit_flush(1). This is what I previously used and it worked fine.</p>
  
  <p>I'm running into an issue since having switched to PHP-FPM wherein I cannot get Apache (2.4) to output PHP's content until the entire script has completed. I still have output_buffering off and flushing in place but that's not enough. Apache isn't using mod_gzip (and that would have affected both the PHP module as well anyway).</p>
  
  <p>Nginx has an option to disable proxy_buffering which, from reading other people's comments fixes this, but I cannot find any way of doing this in Apache.</p>
  
  <p>Here's how PHP is currently being called within Apache:</p>
  
  <pre><code>&lt;FilesMatch \.php$&gt;
      SetHandler "proxy:unix:/run/php-fpm/php-fpm.sock|fcgi://localhost/"
  &lt;/FilesMatch&gt;
  
  &lt;Proxy fcgi://localhost/ enablereuse=on retry=0 timeout=7200 max=500 flushpackets=on&gt;
  &lt;/Proxy&gt;
  </code></pre>
  
  <p>The Apache documentation mentions flushpackets (used above) which appears to be what is needed, but then it also goes on to say that it only applies to AJS for now, not all proxied content so it won't do anything in this case.</p>
  
  <p>Echoing enough whitespace to fill the buffer may work, but it's a messy workaround which is far from ideal.</p>
  
  <p>In short: Does anyone know the correct way of having Apache send PHP content as soon as it's echo'd rather than waiting until script completion?</p>