WordPress WP-Cache with GZip Compression enable

wordpress, wordpress plugin, wordpress blog systemWhat is WP-Cache?
WP-Cache is an extremely efficient WordPress page caching system to make your site much faster and responsive. It works by caching Worpress pages and storing them in a static file for serving future requests directly from the file rather than loading and compiling the whole PHP code and then building the page from the database. WP-Cache allows to serve hundred of times more pages per second, and to reduce the response time from several tenths of seconds to less than a millisecond. (From: WP-Cache homepage)

How to have WP-Cache with Gzip compression enable?
The default WP-Cache plugin do not support gzip compression. If you would like to turn on WP-Cache with gzip compression you need to do some hacking. Here are the steps:-


Download the latest version of WP-Cache

Turn off gzip in the Options.

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

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

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

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

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

That’s it! and now your site should be fast enough!

Credit: Chris Stormer

[tags]wordpress, wordpress hack, wordpress plugin, wp cache, wp cache hack, web, software, web application, blogging tools, blogging[/tags]

Share this with your friends:-

23 Responses to “WordPress WP-Cache with GZip Compression enable”

  1. Pete says:

    When I enable the ob_start(’ob_gzhandler’) I get error with firefox “Invalid compression”. Any idea what is cause of the error… This is also teh same with Chrome…

  2. julian says:

    thanks for the tips, before i cannot enable it event using admin priviledge

  3. ganesh says:

    how to turnoff the gzip

  4. […] 一用上 WP-Cache 就不能用 Gzip 了, 这应该也是出于对服务器的考虑. 但是如果我就是想要开 Gzip 来省流量的话, 怎么办呢? 现在有办法了. 1. 下载最新版的 WP-Cache 2. 关掉 gzip 的选项 3. 编辑 wp-cache-phase1.php 文件: 在 foreach ($meta->headers as $header) { header($header); 前面添加 if ( extension_loaded(’zlib’) ) ob_start(’ob_gzhandler’); 4. 编辑 /wp-content/advanced-cache.php 文件: 在 foreach ($meta->headers as $header) { 前面添加 if ( extension_loaded(’zlib’) ) ob_start(’ob_gzhandler’); 大功告成! P.S.: 我以前的 blog 一页有300多k, 加了之后也就几十k… Gooooooooooooooood.! ^_^ 翻译自: WordPress WP-Cache with GZip Compression enable […]

  5. […] – Ativar Compressão de HTTP “HTTP Compression” Usando o plugin wp-cache2 através do hack descrito aqui. […]

  6. […] soluciones son ésta y ésta, aunque parece que no siempre […]

  7. Hi!

    Which files should be “hacked” in WP 2.3? Cache File only!?


    P.S. You need the “send my a mail if someone write a feeback” Plugin 😉

  8. Jason says:

    I cant do
    Edit: /wp-content/advanced-cache.php

    for some reason advanced-cache.php is showing up as a folder
    im running WP 2.2.3 & WP cache Version: 2.1.2

    I tried to disable, deactivate,no luck
    any idea’s


  9. […] Enable GZip with WP-Cache – Most people know about #3, but what about gzip with WP-Cache. By default, you have to turn off gzip when you’re running WP-Cache. However, that doesn’t mean you can’t use it and you definitely should be since it reduces the size of all Javascript and CSS files.You can find out how to enable gzip with WP-Cache by reading more here. […]

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

  11. videokeman says:

    im having problems with wp-cache expiry time settings but recently i was notified by my hosting of cpu overloads. is it better to use wp’s built in cache?

  12. […] to backup everything in case it doesn’t work. Anyway, here’s the method I followed to update my wp-cache files. Remember, you should still keep gzip disabled in WordPress. Editing the wp-cache code makes the […]

  13. […] according toRussell: http://codex.wordpress.org/WordPress_FeaturesRussell: this pageJase: http://www.techiecorner.com/25/wordpress-wp-cache-with-gzip-compression-enable/Jase: shitzuJase: you going to show me the mockupRussell: yeahRussell: hold on a secondJase: […]

  14. […] Ricardo Galli Granada’s WP-Cache, and adjusted it a bit to enable gzip compression using this […]

  15. […] Added AJAX Comments and enabled caching for faster response times, as our host has been kind of slow of late. As a web software developer, I’m a bit in love with AJAX at the moment, so I couldn’t resist the temptation to add it to our site. […]

  16. […] WordPress WP-Cache with GZip Compression enable – Techie Corner […]

  17. Pakistaniat says:

    Thanks, this is a great tool.

  18. 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

  19. […] Beim WeatherIcon Plugin handelt es sich um die v3, welche noch im Beta-Status läuft, aber anscheinend keinerlei Probleme macht, kann man empfehlen, falls man solch eine Spielerei wirklich will. WP-Cache hatte mich dafür noch mehr genervt mit dem Hinweis auf 0 cached paged, dafür weiß ich nun vermutlich, woran es happert. Im Grunde funktioniert WP-Cache2 ohne Probleme, aber nach dem Einbau des "Weissen-Seiten"-Fixes und des gzip-Fixes scheint es so, als läd WP-Cache2 mutwillig keine Seiten aus dem Cache mehr (0 cached paged) – aber sortiert jene bereitwillig gerne in den Cache-Ordner. Es scheint, als fehle ein Timestamp..oder aber, es wird falsch vergeben oder ausgelesen – nur leider scheitert mein Wissen an diesem Punkt.. […]

Leave a Reply