title: How do I enable mod_deflate for PHP files?
body: <p>I have a Liquid Web VPS account, I've made sure that mod_deflate is installed and running/active.</p>
  
  <p>I used to gzip my css and js files via PHP, as well as my PHP files themselves...  However, I'm now trying to do this via mod_deflate, and it seems to work fine for all files except for PHP files.  (Txt files work fine, css, js, static HTML files, just nothing that is generated via a PHP file.)  How do I fix this?</p>
  
  <p>(I used the "Compress all content" option under "Optimize Website" in cPanel, which creates an .htaccess file in the home directory (not public_html, one level higher than that) with exactly the same text as the "compress everything except images" example on <a href="http://httpd.apache.org/docs/2.0/mod/mod_deflate.html" rel="nofollow noreferrer">http://httpd.apache.org/docs/2.0/mod/mod_deflate.html</a>)</p>
  
  <p>.htaccess file:</p>
  
  <pre><code>&lt;IfModule mod_deflate.c&gt;
      SetOutputFilter DEFLATE
      &lt;IfModule mod_setenvif.c&gt;
          # Netscape 4.x has some problems...
          BrowserMatch ^Mozilla/4 gzip-only-text/html
  
          # Netscape 4.06-4.08 have some more problems
          BrowserMatch ^Mozilla/4\.0[678] no-gzip
  
          # MSIE masquerades as Netscape, but it is fine
          # BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
  
          # NOTE: Due to a bug in mod_setenvif up to Apache 2.0.48
          # the above regex won't work. You can use the following
          # workaround to get the desired effect:
          BrowserMatch \bMSI[E] !no-gzip !gzip-only-text/html
  
          # Don't compress images
          SetEnvIfNoCase Request_URI .(?:gif|jpe?g|png)$ no-gzip dont-vary
      &lt;/IfModule&gt;
  
      &lt;IfModule mod_headers.c&gt;
          # Make sure proxies don't deliver the wrong content
          Header append Vary User-Agent env=!dont-vary
      &lt;/IfModule&gt;
  &lt;/IfModule&gt;
  </code></pre>