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:

<?php

ob_start
("ob_gzhandler");

?>

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!

You Might Also Like...

Share the Love

If you liked this post, why not share it with others?

Comments

Leave a Comment

Name (Required)
Email (Required, but not published)
Website
Comment
Get emails when comments are added. (You can stop emails at any time)

Want an Avatar? Get one at http://www.gravatar.com

Subscribe to Blog

RSS Email

About the Author

David

Hi, i'm David! I've been building websites since 1996. Through my experiences, I have gained a well-rounded knowledge of the design & development of websites. I founded Supadupa Web Design to help others learn from my experiences.

Subscribe by: RSS | Email
Copyright © 2013 Supadupa Web Design