Apache 2.2.17 PHP 5.3.3

Presently, my application does not use gzip, however i wish it to. However, I am unsure of the couple of things:

  1. I understand that IE6 has issues with it you don't need to retrace individuals here.
  2. What benefits/disadvantages exist to applying this in Apache (mod_deflate) versus PHP? Will they essentially produce exactly the same result? I suppose Apache could be more effective, is a proper assumption?
  3. The application creates a number of kinds of reactions: pdf, xml, zip, xls, csv, images (see next point), not to mention the standard AJAX-type stuff.
  4. I have seen that lots of good examples not gzip images, how can this be? Could it be because of the assumption that many images happen to be inside a compressed format, or is there related to it being binary data? I actually do create some images dynamically, and serve others statically.
  5. I additionally stream audio recordings (wav, mp3) using a PHP mechanism any gotchas here?

Basically, if you have implemented gzip on the mature site, and encounter problems, I'd love to be aware what individuals were, and that which you did to operate-around these complaints. Thanks!

  1. Little else to become stated

  2. Get it done in Apache, you can easily setup as well as no switch to your code. You may also arrange it easily to compress css and js files if you would like.

  3. Apache could be set to compress only specific file types

  4. Blending a previously compressed file will more often than not create a bigger file. For those who have uncompressed images, like bmps, you're going to get better results utilizing a compression technique specific to images than using gzip, which means you are best just transforming these to presen, png, digital based on your requirements.

  5. I don't know about streaming, but just like images is applicable to audio. If it's already compressed, don't compress it again, and when it's not, make use of a compression technique specific towards the type.

Essentially, gzip is ideal for blending text files and so i would set Apache to compress individuals. For other things, you will find better solutions if you want it.

Apart from bmp's (if you notice someone with them within the wire, ready your shotgun), images are mainly already compressed, including jpeg's, png's and gif's.

I personally use this during my static subdomains, put together from some online assets (that exist easily Searching):

# Insert filter
<FilesMatch "(?i)^.*\.(js|css|html?|php3?|xml|txt)$">
    SetOutputFilter DEFLATE
</FilesMatch>
# *.cache.js and *.cache.css files are only checked after 6 month (e.g. jQuery.1.4.2.cache.js)
<FilesMatch "(?i)^.*\.(cache)\.(js|css)$">
    FileETag None
    ExpiresActive On
    ExpiresDefault "access plus 6 month"
</FilesMatch>
#AddOutputFilterByType DEFLATE text/html text/plain text/css text/javascript

# 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
# Don't compress images
#SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png)$ no-gzip dont-vary

# Make sure proxies don't deliver the wrong content
Header append Vary User-Agent env=!dont-vary

The only real special factor I have added is the fact that I cache *.cache.js and *.cache.css files for six several weeks, given that they rarely change. E.g. jqueryui.cache.css