In a day where web browsers are becoming the cornerstone of modern computing capable of incredible animations and driven by the most advanced technologies, we need to do our part to make the web faster. Analogous to “zipping” local files to save storage, GZip aims to make the web faster by serving compressed pages and thereby saving bandwidth on both ends at the cost of server CPU time (although this is often negligible). Read more about GZip here.
Before starting off, verify that your site is not serving GZipped pages here: http://checkgzipcompression.com/.
- Login to your Bluehost account CPanel.
- Navigate down to the Software/Services section and click on PHP Config. Select “PHP 5.4 (FastCGI)” and hit save. Then go back to the main CPanel menu. (Note: PHP 5.4 is compatible with most things at this point, but this method will work with PHP 5.2 FastCGI as well.)
- Navigate to the File Management section and click File Manager. Check “Web Root” and “Show Hidden Files (dotfiles)” and hit go.
- On the editor page, scroll down till you find “php.ini” Highlight it and click Edit at the top.
- Search the file (ctrl+f on Windows, command+f on a Mac) for “zlib.output_compression” and look for the following instance:
- Change “Off” to “On” and hit Save Changes in the top right of the editor.
- Go back to the main CPanel. Scroll down to the same place as you did in Step 2 (see above) except this time click Process Manager. Once there, Force Kill all the processes you see (this essentially will reboot your PHP instance). Now visit your site using any browser. You should now have GZip compression enabled.
Drop me a line if this walkthrough worked for you and/or you run into issues! These instructions should be applicable to most shared hosts (especially if they use CPanel backends).