Chris Stormer

Jul 08

Bad Behavior + Wp-cache + Gzip Solution

Submitted on: 2006 at 11:58 pm by Chris Stormer

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 :)

18 Comments | Ping Pong RSS Comment Feed


  1. Chris Stormer
    09 Jul 2006

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



  2. Nick Georgakis
    22 Oct 2006

    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!



  3. Ajay D'Souza
    29 Oct 2006

    Nice short tutorial Chris.

    Do you have BB and WP-Cache running here?



  4. Chris Stormer
    28 Nov 2006

    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.



  5. Ajay
    07 Feb 2007

    Hi,

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



  6. pufone
    26 Jul 2007

    Hello!

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



  7. ivan
    17 Aug 2007

    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…



  8. Beta3
    13 Oct 2007

    Step 5: Activate Gzip ;)


Leave Your Juicy Thoughts

Name: (required)

Email: (required but will never be displayed)

Website:

"As you type" the preview will update, enjoy...

#
13 Oct 2007