Serving Gzip-compressed pages with PHP
https://marco.org/2010/04/22/serving-gzip-compressed-pages-with-php
I’ve had nothing but problems with PHP’s built in zlib.output_compression
feature: the most common issue is that it holds connections open for a very long time, introducing long delays (and largely negating the point).
But using mod_deflate in Apache achieves the same thing with none of the negatives, as far as I’ve seen. In your VirtualHost definition:
AddOutputFilterByType DEFLATE text/html text/css text/javascript
And you can expand that text/html
list to a lot of different content-types. I usually add text/plain
, text/xml
, and application/rss+xml
.
I’ve been using this solidly for years, but I forgot to add it to my SSL VirtualHost definition on Instapaper with the new server until last night, and it makes a huge difference in load times.
Throwing this into Google, for whatever it’s worth.