Check out my latest project: Jukebox Star - Free Social Music Video Jukebox!

Speed Tip: Enable Gzip Compression in PHP

Probably the quickest, easiest way to speed up your website in 5 minutes.

Anyone who has been creating websites over the past couple of years knows the importance of speed. If your website doesn't load quick enough, your visitors are going to click the back button before they even see the page. So, one of the quickest ways to quickly speed up your website is to enable Gzip compression in PHP.

What is Gzip Compression?

Gzip Compression is like zipping your webpage content before it's sent to the web browser so it transfers quicker. Most modern browsers support gzipping and can easily read gzipped content. Gzipping your web pages can often times speed up the page load up to 60%!

How to Enable Gzip Compression in PHP

This is super easy, just add the following line at the very top of your PHP. If you use a header file of some sort, stick in there:




Thats it! Nothing else needed to be done. Wasn't that easy!

Enable Gzip Compression on CSS and JavaScript

You can go even further by gzipping your javascript and CSS. The easiest way I have found is to allow PHP code to be executed in CSS and JavaScript. Once you have done that, just stick the line above into every CSS and JavaScript file you have and your done.

Trust me, you will notice the deifference!


Marlin Gavker @ 12th Nov 2014

You can also enable Gzip through the .htaccess file by enabling mod_deflate with it. You need to upload it to the root of your server. Found how to do it here: hope it helps.

Add a Comment

required, but not shared

© 2018 Supadupa Web Design