Enable Gzip Compression

One of the things that Page Speed recommended was to Enable Gzip Compression. I’m not going to go into all the ways I tried to implement this (and blew up the site in the process. I’m going to cut to the chase and show you the steps it took to get this in place and working.

This is part of what I meant when I said get your geeks speak dictionary out. In order to Gzip your site you need to have the zlib activated on your site. You do this in the php.ini file. Or in some hosts (GoDaddy) it will have to be php5.ini, if you are running PHP5

Create PHP info

This step is necessary so you can see what the php setup is on your site and verify that the changes you make are in place.

Open Notepad and paste this:

<?php phpinfo(); ?>

Name the file phpinfo.php and FTP it up to the root of your blog.

Go to your site in a browser and at the end of the url add /phpinfo.php This will show you a lot of information, you will see zlib somewhere in there.

This is after activation

Modifiy the PHP.ini file

Add this to the php.ini or php5.ini file that is in the root of your hosting directory

If the blog is in the root directory that is where the php.ini file should be located. If it is in another directory under the root hosting directory you will need to add this code to the root directory php.ini file.

Modify your Theme Header

Add this code in the header of your theme “ABOVE THE FIRST LINE”

<?php ob_start(“ob_gzhandler”); ?>

Once this is in place:

Open your site in a firefox

Open Firebug

Run Page Speed Analyze

You should no longer see a RED enable gzip compression

This should help reduce your page load time.

But remember what I said in the first post. If you have a caching plugin installed, you will need to deactivate it, clear the cache, make these changes and then activate the cache plugin again.

Next we will take a look at changing some of your generic php code in your theme to specific HTML. This will reduce the number of database queries and help your page load speed.

Comments

Thanks for this. I just got the Page Speed plugin last week and saw that Google recommends Gzip but I had no idea what it is or how to do it. How much load-time does this really save? I guess any time saved, even a fraction of a second, is better than not. But if it’s such a useful thing to do, I wonder why it’s not built into WordPress by default… .-= Josh´s last blog ..Calgary Movers =-.

Would Gzip speed up the page load time for my 246 blogs I have on two WordPress MU sites on a dedicated server? One of the things I’ve done to speed up page load time is to install WP Super Cache. It seems to work well. The two blogs I’m most interested in working very fast are:

If you are using super cache I wouldn’t bother with gzip. But it wouldn’t hurt. I personally don’t like super cache or any of the caching programs I’ve tried. To often they interfere with changes made. Like new plugins or theme tweaks. Especially when you are trying to work on the site and see the changes. So I stay away from cache plugins.

I use Drupal for my site malinamusic.ru and I though the same way till I found one checkbox in Drupal Performance configuration. And it combined all external Javascripts of all external modules I use automatuically for me. I suggest you to look for you platform settings. It might have it. I guess you use wordpress?

After reading this I realized the problem that I was having all along was zlib wasn’t activated on my site. The people at godaddy should of explained to me that I had to activate it in order gzip my site.

Ok this is something i can’t fix on blogspot then. Im out of ideas how to reduce the page load timed of my blog other than removing pics. I don’t understand why google counts all posts on my homepage as a part of it as a whole even though i have “read more” links after only few sentences for each post. I mean, lets say i have 10 previews of actual posts (with just one picture for each post) on my homepage and “read more” for every of those posts. And, all of those posts have their own separate pages. So why would all those posts count as a part of homepage like they are completely there and not just their previews. Sorry for bad english, but i hope you understood the question. Tnx