Question

I was just doing some testing with YSlow and it's telling me:

Grade F on Compress components with gzip: There are 10 plain text components that should be sent compressed

I know that Apache 1.3 uses mod_gzip while Apache 2.x uses mod_deflate, and so the easiest solution to remedy this is to use mod_deflate on an Apache 2 server.

However, I've checked with two shared hosting companies and one local company and they've all told me that they don't support mod_deflate.

I know that some older browsers have trouble accepting gzipped / deflated content, and I'm not suggesting it be enabled by default, but are there any negatives for making mod_deflate available? Is it just extra load on the server's processors?

Also, are there any alternatives? I saw that if you are using a CMS like Wordpress you could potentially install a caching plugin which would serve out gzipped cached versions of the pages initially generated via PHP.

Was it helpful?

Solution

Compression takes CPU time. Maybe the hosting company decided they care more about CPU than network traffic. Maybe they offer it with a more expensive package. MAybe they simply didn't add it. Only your hosting company would know.

When using PHP you can check whether your PHP setup has zlib support enabled. If that is the case you can use ob_start("ob_gzhandler"); in code to enable an output buffer which will compress your data or set zlib.output_compression in your php configuration for instance by using php_flag zlib.outout_compression on in your .htaccessfile.

http://php.net/ob_gzhandler

http://php.net/zlib.output-compression

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top