How to enable gzip on PHP the easy way!



Gzip can reduce page size by an impressive amount, especially for high traffic sites. We have optimised some of customers sites receiving high traffic and have easily been able to reduce bandwidth usage by 60-80%.

If you have zlib compiled into PHP and you are running PHP then the easy way to enable gzip compression is to add the following line to your .htaccess file:

php_value output_handler ob_gzhandler

This will only enable gzip compression on PHP, and not on css, javascript, html, etc files – this needs to be done in the apache config file.


 


 


Categories