=

desalasworks presents:

a selection of works by steven de salas

WordPress Compression Plugin

This plugin allows your WordPress blog to output pages compressed in gzip format if a browser supports compression.

Plugin Homepage

You can now find the plugin listed in WordPress.org.

Coding the Plugin

  • I noticed once I installed WordPress and started using it for desalasworks.com that it does not support gzip HTTP compression, apparently this support was removed from version 2.5 onwards.
  • HTTP Compression is a no-brainer for optimising your blog. HTTP compression generally means a 60-80% reduction in page size (and broadband usage) as well as an increase in download speeds of 3x to 4x.
  • As of January 2010, more than 99% of browsers support compression. For the less than 1% that do not, WordPress will still send them uncompressed pages.
  • Having already enabled compression on my own VisualSite (.NET) Content Management System I decided to write a plugin for WordPress to enable this as well.
  • The key component of the plugin is a call to the zlib PHP compression library as follows
    • if(!ob_start(“ob_gzhandler”)) ob_start();
  • For more information have a look here: PHP ob_gzhandler

Download The Plugin

Installing the Plugin

  1. Download the `wp-http-compression.zip` plugin to your desktop.
  2. Navigate to the ‘Plugins’ menu in WordPress
  3. Click ‘Add New’.
  4. Select ‘Upload’ from the options at top of the page.
  5. Select the file `wp-http-compression.1.0.zip` and press ‘Install Now’.
  6. You should get a message saying ‘Plugin Installed successfully’.
  7. Activate the plugin.
  8. Go to http://ismyblogworking.com/ to test compression
  9. Check “Page GZip” on the right hand size.
  10. Check “Bandwidth saved by compression” on the left hand side.

Comments

43 comments

  1. A Visitor says:

    17 Feb 2010 13:07:27 – I Like This!

  2. DSLR Reviews says:

    Good plugin. Only problem i found is it clashes with a database backup plugin i was using, wherein it stopped me getting into the dashboard. A minor problem.

  3. steven says:

    Hi James, what’s the name of database backup plugin? I’ll have a look at it.

    Thanks,
    Steven

  4. John says:

    Hy,
    I’m getting this error:
    Warning: ob_start() [ref.outcontrol]: output handler ‘ob_gzhandler’ cannot be used twice in ….
    and i am not using wp cashe or any other related plugin.
    How do i fix this?
    you can also email me.
    thanks

  5. Aprazeth says:

    Hi Steven,

    For me it is the google analytics plugin (3.2.5 – http://yoast.com/wordpress/analytics/#utm_source=wordpress&utm_medium=plugin&utm_campaign=google-analytics-for-wordpress)

    With these 2 enabled it seems that the WP-Admin/index.php all of a sudden isn’t accessible anymore.

    Hope this helps!

  6. steven says:

    Hi Guys,

    John: It seems something else is already gzipping your files so this plugin wont make any difference to downwload speeds or bandwith usage on your site. Maybe its a server setting with your hosting company?

    Aprazeth: Thanks for the heads up about this plugin conflict. I’ll have a look at this problem and include it in the next release. Cherio! S

  7. Den says:

    Hi,

    I have WP Super cache enabled in my blog. Is it ok to use http-compression alongwith WP Super cache

    Thanks in advance for reply

  8. Gundars says:

    Not working for my site :/
    results = http://ismyblogworking.com/gkm.lv

  9. steven says:

    Hi Gundars,

    Seems fine now. I can see “Bandwidth saved by compression: 62.8%”.
    Did you figure out what went wrong?

  10. Integrati says:

    Hi Steven,

    I love this plug in we have been playing with the .htaccess codes with marginal success. Although the site did have one issue where the site dropped connection to the WP database for about 30seconds but then auto-magically just came back.

    I think and hope this was a one time issue, it was too quick for me to screen shot, sorry.

    By the way integrati.com.au now experiences 74% saving on bandwidth after implementing your plug in and a content ration of 33.1% which = awesome!

    Thank you.

    🙂

    Will be recommending this for client sites as well.

    Kind regards, Integrati Marketing.

  11. A Visitor says:

    16 May 2010 04:44:26 – I Like This!

  12. Integrati says:

    Hi Steven,

    quick question for you, I am using Yahoo YSlow embedded in Firebug 1.5.4 and also Google Page Speed in Firebug and both are reporting that their is no Gzip Compression on my site integrati.com.au

    Now when I check via the site http://ismyblogworking.com/integrati.com.au with my site it all looks good.

    Now I am positive that this is working as the site is definitely faster I was just wondering if you were aware of this potential issue or false negative with these Firebug tools.

    Appreciate your insight, thank you. 🙂

    Integrati Marketing.

  13. steven says:

    Hiya Integrati,

    Im not sure about YSlow and Google Page Speed but from what I’ve seen of firebug before it doesnt highlight if a page is being gzipped or not. My guess is this bit is handled by the browser so by the time the http response arrives its already decoded. Firebug will flag if the request was made asking for gzip but in the past I’ve had to check the file sizes in the “Net” tab and compare them to the real files in order to verify they were indeed being compressed.

    S

  14. Integrati says:

    Got it, thank you Steven!

    Cheers, Integrati.

    Thank you for your reply!

    🙂

  15. Tadeu says:

    Como diria meu amigo du ,pqp o plugin é very cool my site work 4x much fast!

    Tanks!

  16. Hello,

    I am using the plugin, but there seems to be an incomatibility with the Free CDN plugin: I can use either Free CDN or WordPress Compression, but when I use both I get the following error message in Firefox:

    “Content Encoding Error

    The page you are trying to view cannot be shown because it uses an invalid or unsupported form of compression.”

    Any idea what could be causing this and what I can do about it?

    I have cross-posted a similar message on the Free CDN site.

    Thanks,
    Michael

  17. Paul says:

    Hi. I used this plugin with success for a few months but as my site grew to 2500+ pages, it now causes the site to white screen if activated. Took me forever to single it out as the culprit. I’ll try super cache and see if that works. Cheers!

  18. Marie says:

    Hi Steve,

    I just found out that this plugin made plugin installer in WordPress 3.0 impossible to use. Every time I tried installing a plugin, it would stop at “Downloading install package from http://downloads.wordpress.org/plugin/xxxx.zip and never proceed to the next steps. I have unactivated and activated your plugin several times to make sure… It is a pity cause I really would like to use both your plugin and the installation feature 🙂

    Marie

  19. Dave says:

    Noticed that when using this with version 3 that installing plugins (and updates) don’t re-enable after updates. You also don’t get to see the status updates. Disabling this plugin returns WordPress to its normal behavior… Probably more to do with compression and streaming – but it wasn’t an issue with the previous version of WordPress.

  20. steven says:

    Hi Dave / Marie,
    Thanks for flagging this up, I been busy working on other projects so haven’t had much time to look into this plugin.
    I havent checked compatibility with version 3 of WordPress but will have a look and get back to you right away.

  21. steven says:

    Hi Paul,
    Thanks for flagging this up. The number of pages shouldnt affect things, its more about the popularity of the site. It takes a little processing power to compress each page. Too many visits and the server has to sit there crunching away compressing each page. If you have 15 requests a second thats a lot more processor usage that a page every so many minutes, and if you take into account that most hosting providers will cram 200 sites or more per server that may not leave a lot of processor power left for you. This plugin is recommended for sites that have low to medium traffic after that super-cache or wp-cache will probably work better but bandwidth usage might go up, sorry it couldnt work out for you.

  22. steven says:

    UPDATE REGARDING WORDPRESS 3.0

    I have installed WordPress 3.0.1 (this page you are looking at) and tried deleting and re-installing the WP-HTTP-Compression Plugin directly from the wordpress site.

    I am happy to confirm that EVERYTHING IS WORKING AS NORMAL. The issues mentioned by users above probably have to do with inter-plugin compatibility (sometimes two plugins are not very happy living together) or some other quirk to do with the server where wordpress is hosted.

    You can check for yourselves. Currently the statistics for this page are as follows:

    Compression Status: Compressed (gzip)
    Percentage Saved by Compression: 74%
    Transfer Speed Improvement: 4.0 x

    http://www.port80software.com/tools/compresscheck.asp?url=http://desalasworks.com/wordpress-compression-plugin/&

  23. Jeff says:

    I tested my site and got this:

    Your blog application doesn’t support gzip compression.

    Any thoughts?
    http://travelnursingblogs.com/

  24. Gerardo says:

    EXELENT!

    Original Size: 40.25 KB
    Gzipped Size: 6.63 KB
    Data Savings: 83.53%

    😀

  25. cnxsoft says:

    After installing the plugin with WordPress 3.0.1, my blog (http://www.cnx-software.com) still does not support gzip compression.

  26. iPhone says:

    This plugin works really great but once installed and when I try to upload a photo I have this message : Warning: ob_start() [ref.outcontrol]: output handler ‘ob_gzhandler’ cannot be used after ‘URL-Rewriter’ in /homez.38/anotherlq/generationiphone/wp-content/plugins/wp-http-compression/wp-http-compression.php on line 30
    240

    Do you know how to fix it please?

  27. steven says:

    Hi iPhone, never seen that one. Will take a look and let you know.

  28. David says:

    I installed it and only my home page would pull up, the rest of my site would just load a completely blank white page. I tried on multiple computers and different browsers, soon as I disabled it, they would all load back up immediately. Any ideas?

  29. Narada says:

    Steven. Just to wanted to say a word of thanks. I’ve been using this plugin for a very long time but unfortunately it has taken me this long to express my gratitude. This is by far my favourite plugin and has meant the difference between a slow load and an instantaneous load of my site. This is a fantastic plugin and I really hope it continues to work for all future wordpress versions as I just couldn’t live without it. YSlow and PageSpeed have both shown significant increases in speed after I started using it. Many thanks and all the best.

  30. I use this plugin in my two blogs. So far so good, even performance increases sharply. Thank you for sharing.

  31. Janmejai says:

    When i tried to use it with W3 Total Cache it show me an error,what to do???

  32. Zach says:

    This worked really well for me. Thanks for making it!

  33. prakash says:

    thank for sharing it

  34. Ryan says:

    It has been good for a while. However recently it slowed down my web site significantly. After deactivating this plugin, CPU load averages decreased from 3.00 to 0.17.

  35. Sunny says:

    Very nice plugin, used in all my wordpress blogs. But having problem when updating things for example: when an update is needed for another plugin, it just stopped in the “downloading plugin” page.

  36. Marta says:

    Hi!

    I’d love to be able to use your plugin, because once I activate it my speed scores according to gtmetrix.com rise to A. However… I’m afraid I can’t use it because all my youtube videos disappear (no matter which browser I’m using).
    That’ really bad, because nothing else has given me your speed results… If you could help me out getting the vids back, I’d be your most devoted fan.

    Thanks,

    Marta

  37. Marta says:

    Hi again!

    I just realized what’s causing the problem, but I don’t know how to solve it because I don’t know how to code: since the page is on https, my browsers see the videos as insecure when your plugin is activated, and therefore they block the videos.

    Maybe that helps you figuring out how to help me out. Thanks again!

  38. Aniruddha C. says:

    very nice plugin recommended 🙂

  39. Brian says:

    Same issue here for a while, wordpress/plugin updates/installs “stop”. They actually DO install/update, but the page won’t show that, it stays on the updating etc forever.

  40. After installing the WP HTTP Compression, I got the sliders disappeared due to plugin confict. My installed plugins include: W3 Total Cache for faster loading speed, Contact Form 7, Accurate Form Data to check form email validation, Tiny MCE Editor for advanced text editing. Thanks!

  41. Hello Steven de salas, the given plugin was very useful for me, and the steps to install the plugin was useful while installalation, keep on providing valuable source. Thanks for sharing!!!

Leave a Reply

(Spamcheck Enabled)