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.
Modifiy the PHP.ini file
Add this to the php.ini or php5.ini file that is in the root of your hosting directory
zlib.output_buffering = On
zlib.output_handler = ob_gzhandler
zlib.output_compression = Off
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.
Related Posts :
Post Tags: enable gzip , php.info , zlib
TinyURL For This Post: http://tinyurl.com/y9ah77e












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
Josh,
Gzip is server side application. It can’t be built into WP.
Dave
Hi Dave,
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:
Indianapolis News, Events, Information, Photos and Videos
Indianapolis Real Estate and Indianapolis Homes For Sale
Any other advice or articles you’ve done about speeding up a blog?
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.
Dave
Dave, thanks for the fast response. I have had the trouble you’ve talked about when I make changes. I have to delete the cache files before I can see the changes, at times.
I’ve tried this, but I don’t have a php.ini or php5.ini file in my root directory.
Bill Bennett´s last blog ..Writing tips: “If it sounds like writing, rewrite it”
Bill,
Where is your site hosted? Did you check to see if Gzip was already enabled? Some hosts are doing that automatically now. (Bluehost being one) so you don’t have to turn it on.
Dave
Hi,
I just run Page speed on thi page and it gives only 63% and propose to enable compression for the page
Alexei,
I thing you might want to check that again, there is a green check mark next to enable compression which means it is enabled.
The other things they recommend which brings the score down, are really unnecessary and not advised for dynamic pages or those who don’t have their own server (which is the majority of us)
Dave
Yeah, you are right. BTW, one thing that might really improve the score of the page and speed is combining external JavaScripts. i did it on my Drupal sites and speed difference was dramatic.
Alexei,
Unfortunately, those scripts aren’t ones we have control over, they are handled by plugins on the blog. Combining them doesn’t seem to be possible.
Dave
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?