WP-Cache2 is a great way to speed up high-trafficked WordPress sites by caching their output as static pages. The only downside is that you have to turn off gzip compression in WordPress, which can actually make some pages slower to download. Wouldn’t it be great if you could have the best of both worlds? It appears that you can.
I think the problem was that with WP’s gzip turned on, it was caching the gzipped output. I edited wp-cache-phase1.php and put in the following:
if ( extension_loaded('zlib') ) ob_start('ob_gzhandler');
right above this line:
foreach ($meta-»headers as $header) {
And it seems to work beautifully. That caches the plaintext, but gzips the text before delivering on cached hits. Might work for people who can’t mess with server configuration files.
You can see it in action over at the WP Hooks Database.
I’m going to try that out here on WP.com.
Hmm, it looks like we’re already doing gzip at the server level, so not needed.
Yeah, if you control your server, you can always just do that… I’m hoping that this will be of some use to the many people on shared hosting.
well, if only WP-Cache worked with WP2, the world would’ve been a much better place!! 🙂
WP-Cache2 works just fine with WordPress 2.0 and 2.0.1 on every server I’ve installed it on.
I tried this but WP_Cache2 plugin is couching up this error:
Warning: GZIP compression is enabled in WordPress, wp-cache will be bypassed until you disable gzip compression.
WP-Cache is Disabled
Disable Gzip compression in WordPress… let WP-Cache2 (modified) handle it.
Hello Mark,
The latest version of WP-Cache is 2.0.17; and if it detects GZip, with or without your mod above, it will disable caching. So, I’m not too sure what you mean by comment #7…..
WP-Cache2 disables caching if it detects that you have enabled gzip compression from within WordPress. With my mod you are doing the compression from within WP-Cache2 and so you should turn of gzip compression in WordPress. The problem is that if you do the compression in WordPress, it gets cached as compressed code. By doing in in WP-Cache2, you can save the cache as plaintext, but compress it when you deliver it.
Ouch… Thanks for clearing that up..
I’m glad I checked back here for a reply, because I had gone ahead and implemented your patch, then removed all gzip checks from Gallir’s code, and on top of that enabled WP gzip….. It “worked” great until I realized it wasn’t caching anything 😛
Thanks Mark!!!
Strange… I wonder why this isn’t just made an option in wp-cache. So you disable gzip in WP itself and enable again from wp-cache options panel.
Seems to be working for me.
I tried adding above line , but as soon as i enable gzip, cache gets disabled.
Kamran
Kamran: Read carefully, please. You have just to add the line to wp-cache-phase1.php, that’s all… DO NOT enable gzipping in WP options panel, leave it switched off. Then take a look at HTTP headers sending by your server – gzipping works. Tested on WordPress 2.1.3 + WP-Cache 2.1.1
coolness.. at first im a little bit skeptic trying it out, but yeah, my page did load faster.. good job..
=)
this does not work when i test it with a compression check, still shows my site as being uncompressed
I wonder If it does allow you to use WP-Polls for example. Do you guys have any experience?
Thanks this really speeds up my blog
thank you, but gzip compression is also an essential think for the faster page loading.
Thanks friend!
I speedup my blog pretty much…
thanks friend..
it helps me
Thank you. Very Good Sharing.
Disable Gzip compression in WordPress… let WP-Cache2 (modified) handle it.