Bad Behavior + Wp-cache + Gzip Solution

So while installing some nice spam protection, I came across some interesting conflicts between.

1. Bad Behavior (The spam filter plugin)
2. WP-Cache (The Speed the site up plugin)
3. GZIP (The zip the page and server it to you faster feature built into Wordpress).

Basically wp-cache doesn’t work with gzip and bad behavior doesn’t work with wp-cache.. how to fix this?

1st: Go out and download the newest versions of both wp-cache 2 & Bad Behavior

2nd: Turn off gzip in the options.

3rd: Edit: wp-cache-phase1.php
Add This line:
if ( extension_loaded(’zlib’) ) ob_start(’ob_gzhandler’);

Before this:
foreach ($meta->headers as $header) {
header($header);

4th: Edit: /wp-content/advanced-cache.php

Add:
if ( extension_loaded(’zlib’) ) ob_start(’ob_gzhandler’);

Before this:
foreach ($meta->headers as $header) {

Now everything shouldu play together nice. Your site should BLAZE and be protected.

Enjoy :)

21 Responses to “Bad Behavior + Wp-cache + Gzip Solution”

  1. Chris Stormer

    Maybe I should add some graphics, this isn’t nearly as nice looking as I had hoped. ;)

  2. SigT

    Parches para WP-Cache

    WP-Cache 2.0 es un sistema de cache de páginas realizado por Ricardo Galli (con algo de testeo y documentación por mí parte en los inicios ;) ) imprescindible para aliviar la carga del servidor y los tiempos de carga de los blogs basados en WordPres…

  3. Wordpress WP-Cache with GZip Compression enable - Techie Corner

    [...] Credit: Chris Stormer [...]

  4. Thanks WP-Cache!!! « Jayant Kumar Gandhi

    [...] Chris Stormer [...]

  5. www.ngtech.gr » Modifying WP-Cache 2.0 to generate and cache gzipped output once and serve it multiple times

    [...] http://chrisstormer.com/2006/07/08/bad-behavior-wp-cache-gzip-solution/   or http://markjaquith.wordpress.com/2006/01/31/wp-cache2-and-gzip/ [...]

  6. Nick Georgakis

    Hello Chris, You might be interested checking out an enhanced way of adding gzip support to wp-cache , which caches the gzip output , avoiding to compress it again every time a client requests it.
    You can find it
    here

    If you could try it / verify it works that would be great!

  7. Ajay D'Souza

    Nice short tutorial Chris.

    Do you have BB and WP-Cache running here?

  8. Chris Stormer

    Ajay,

    Actually I turned off BB mostly because I was catching most of the spam with other menthods and I’m always trying to eek out every ounce of speed I can snag.

  9. Ajay

    Hi,

    i’m just wondering about advanced-cache.php , isn’t the wp-content/ supposed to be just a symbolic link?

  10. Eite Webs - Official Blog » Blog Archive » Save Bandwidth with gzip Compression

    [...] Mark Jaquith and Chris Stormer have found that a minor change in the the code of the plugin can turn on GZip [...]

  11. Save Bandwidth with gzip Compression » Ajay - On the Road called Life!

    [...] Mark Jaquith and Chris Stormer have found that a minor change in the the code of the plugin can turn on GZip [...]

  12. pufone

    Hello!

    Does this solution involve compressing the cached file each time it’s accesed?

  13. Playing With Wire » Yahoo!’s YSlow Helps You Optimize Your Site

    [...] How to set up compression depends on your application and web server software. If you’re using Apache, you can have the server do it for you for normal files. For dynamic content such as that generated by PHP it depends. In WordPress there’s a switch in the Options. If you’re using wp-cache like Playing With Wire is, it may take some more work. [...]

  14. Scaling WordPress - I’m Mike

    [...] issues that may arise. If you’re a real performance junkie you may be interested in a simple hack to enable gzip with [...]

  15. ivan

    content is compressed each time, but many tests show that this actually works faster since there’s less output to send out, than with uncompressed content, thus pages are served faster

    ps. Chris, this page is all broken in my firefox ? Sidebar is covering the part of the content…

  16. Optimize WordPress in another 3 steps by Refactor the Life

    [...] the official WP-Cache suggests to disable GZIP support, there are some hacks(1, 2) to enable it. That is quite [...]

  17. Beta3

    Step 5: Activate Gzip ;)

  18. Gzip Compresssion Now Enabled

    [...] I found this hack on chrisstormer.com [...]

  19. Lesha

    In terms of bonalnoy erudition – grammotno done!

  20. Scaling WordPress | infopal - palestina

    [...] issues that may arise. If you’re a real performance junkie you may be interested in a simple hack to enable gzip with [...]

  21. Scaling WordPress

    [...] issues that may arise. If you’re a real performance junkie you may be interested in a simple hack to enable gzip with [...]

Leave a Reply