Instead of gzipping from PHP (which means that only HTML content compressed will be compressed), you can ask Apache to compress for you - using mod_deflate .
A big advantage: this will allow your server to compress HTML, of course ... But also JS and CSS; which means a huge win for users who have to download them when visiting your site.
Note: if you are not using Apache, other web servers have mod_deflate equivalents; -)
source share