WP Super Cache 0.9

WP Super Cache version 0.9 is now available. WP Super Cache is a page caching plugin for WordPress that will significantly speed up your website.

Update – if your blog is installed in a sub directory instead of at the root of your server, the .htaccess file might be wrong. Download and install the development version which corrects this. You’ll have to edit the .htaccess file (anyone want to volunteer to write an auto-upgrader?) and remove the rules between the lines # BEGIN WPSuperCache and # END WPSuperCache. Delete those lines too and visit your admin page. The plugin should do it’s stuff and spit out correct mod_rewrite rules for you. The dev version also has a few other bug fixes so if you’re adventurous have fun upgrading!
There’s no need to touch wp-content/cache/.htaccess

Are we nearing version 1? Possibly. In this release a number of bugs have been fixed and the following new features added:

  1. Mobile user agents are detected and a different cache page created for them. If you use a plugin that displays a different theme to these devices it will hopefully work now. The plugin changes to “half-on” mode because the detection is done by PHP. Thanks to Alex King‘s WordPress Mobile Edition plugin for the detection code.
  2. The number of cache files will be more than halved on a normal site with plenty of anonymous visitors. This should be a huge win for WordPress MU sites and very busy blogs.
  3. The last and next garbage collection times are displayed on the admin page now.
  4. In previous versions the newly generated page was delivered uncompressed to the first visitor even if the browser supported compression. I’ve fixed this but I’m not 100% certain it will work for everyone so it’s disabled by default. Edit wp-content/wp-cache-config.php and add “$wp_cache_gzip_first = 1;” to enable this. It’s enabled here.
  5. If expiry time is longer than 30 minutes, garbage collection will be done every 10 minutes, else it’ll be done 10 seconds after the expiry time.
cache-contents

Unfortunately wp-content/advanced-cache.php will have to be updated again and it’s not as simple as copying the file from the plugin directory. Full instructions are printed on the admin page and it should auto update in most cases.

PS. Test your upgraded blog on Is my blog working, a project by fellow Automattican Alex Shiels.
Here’s the page for this site. 102ms page generation time is rather fast!

Comments

comments

107 Replies to “WP Super Cache 0.9”

  1. I’ve been using this great plugin for a while, It helps me keep our website up and running on a shared service, we have around 40K pageviews a day. Since version 0.8.6 if I’m not wrong, I noticed that the garbage collection is not working, the expired pages keep piling up and I need to delete them manually from the admin page

    Did anyone run into this problem ? I appreciate your help in advance

    Thanks,
    Eduardo

  2. I did find a small error with 0.9. When you enable the “Cache Rebuild” feature it doesn’t all wordpress to email comments to the admin.

    Once I disabled the rebuild comments were emailed again but not ones made when the rebuild was active.

    I realize the rebuild is experimental but figured I would let you know what I found it doing wrong.

    Other than that, great job on 0.9 and thanks for your dedication to a wonderful plugin

  3. techseaport: requests to your blog are handled by a CDN (velocix.com). It’s possible that is interfering with HTTP headers or negating the benefits of WP Super Cache and/or gzip compression. (It might be the case that you don’t really need them).

    The “your blog probably doesn’t support browser caching” message might sometimes be inaccurate – I’ll improve that soon. But the gzip report is correct. From this side of the net, it looks like your blog isn’t using WP Super Cache or Gzip at all.

  4. this might be dumb question but here goes… I’m referring to the mod rewrite rules section of the plugin’s panel in wordpress where it says:

    Mod Rewrite Rules

    WP Super Cache mod rewrite rules were detected in your /home/rostam/public_html/.htaccess file.
    Click the following link to see the lines added to that file. If you have upgraded the plugin make sure these rules match.

    >View Mod_Rewrite Rules< (button)

    # BEGIN WPSuperCache

    RewriteEngine On
    RewriteBase /
    AddDefaultCharset UTF-8
    RewriteCond %{REQUEST_METHOD} !=POST
    RewriteCond %{QUERY_STRING} !.*=.*
    RewriteCond %{HTTP:Cookie} !^.*(comment_author_|wordpress|wp-postpass_).*$
    RewriteCond %{HTTP:Accept-Encoding} gzip
    RewriteCond %{DOCUMENT_ROOT}/wp-content/cache/supercache/%{HTTP_HOST}/$1/index.html.gz -f
    RewriteRule ^(.*) /wp-content/cache/supercache/%{HTTP_HOST}/$1/index.html.gz [L]

    RewriteCond %{REQUEST_METHOD} !=POST
    RewriteCond %{QUERY_STRING} !.*=.*
    RewriteCond %{HTTP:Cookie} !^.*(comment_author_|wordpress|wp-postpass_).*$
    RewriteCond %{DOCUMENT_ROOT}/wp-content/cache/supercache/%{HTTP_HOST}/$1/index.html -f
    RewriteRule ^(.*) /wp-content/cache/supercache/%{HTTP_HOST}/$1/index.html [L]

    # END WPSuperCache

    Rules must be added to /home/ABCD/public_html/wp-content/cache/.htaccess too:

    # BEGIN supercache

    AddEncoding gzip .gz
    AddType text/html .gz

    SetEnvIfNoCase Request_URI \.gz$ no-gzip

    Header set Cache-Control ‘max-age=300, must-revalidate’

    ExpiresActive On
    ExpiresByType text/html A300

    # END supercache

    I’ve checked the wp-content/cache/.htaccess file and it has this in it:

    # BEGIN supercache

    AddEncoding gzip .gz
    AddType text/html .gz

    SetEnvIfNoCase Request_URI \.gz$ no-gzip

    Header set Cache-Control ‘max-age=300, must-revalidate’

    ExpiresActive On
    ExpiresByType text/html A300

    # END supercache

    so is everything ok then? or should it also have the first section -which starts…

    # BEGIN WPSuperCache

    etc.

    thank you so much for this plugin!!

    🙂

  5. Tonight I finally made the jump, but I think there’s something wrong 🙁 I see cache files are being generated in /cache, but the admin page keeps reporting ‘0 Cached Pages, 0 Expired Pages’. I have made all necessary changes to both /.htaccess and /wp-content/cache/.htaccess, removed the old symlinked advanced-cache.php before upgrading and everything seems to look allright, except the server doesn’t seem to serve the cache files.

    I have unchecked the experimental ‘Rebuild Cache’ option for now and my setup is in ‘Half On’ mode for the mobile browser support (option: ‘Mobile Device Support’ is checked)

    Any input would be much appreciated!

  6. Further info: this is a highly visited website (+40K pageviews daily). There’s now 247 cache files in /wp-content/cache, with the admin page reporting 4 (and 0 expired).

    PS Does it still make sense to enable the ‘Rebuild Cache’ feature even though Super Cache needs to run in Half Mode because of the mobile browser support?

  7. Jean-Paul – there’s no point using the rebuild cache feature in half on mode as you’ve guessed. Did you remember to clear out the rejected user agents textfield?

  8. Hi Donncha,

    Yes, I certainly did 🙂 (I actually did a complete uninstall and removed my old wp-cache-config.php to start completely fresh). I was also wrong with my pageviews (wrong stats page), it’s actually 100+ pageviews daily. Cache file count is now at 411 files, with the admin page reporting 16 Cached Pages / 12 Expired Pages. Expire time is set to 600 seconds. Garbage Collection reports Last: 2009-01-29 08:26:43, Next: 2009-01-29 08:36:43

  9. I have no idea if the plug-in is working right or not, but I’m going to have faith that it is. So, for thank a plug-in developer day (a day late) I just wanted to say thanks for trying to help me delivery up my pages with the least stress possible. Thanks!

  10. I just installed super cache on 3 of my blogs because my host told me I was overloading the server/database. I also changed to pconnect for mysql.

    Two questions.

    1) I am told by the plugin that “mod_expires” is missing. Is this something my host needs to implement for me?

    2) I have a banner ad plugin (wpads) that rotates banners throughout the site. I’m guessing if a page is cached it is going to keep displaying the same banners rather than allowing wpads to randomly rotate content. If so, is there a way around this?

    Thanks for all your hard work!

  11. I am using a virtual dedicated hosting plan and it seems that supercache is using all my memory since I upgraded to 0.9 ==> my website is dead. I had to disable it. The last stable version for me was 0.8.5.

    Thanks anyway.

  12. List guy – yes, your host needs to install it. Banners might be the same, depends if it uses Javascript or not. The good ad rotation scripts use Javascript.

    Joshua – thanks!

    Tathy – see the FAQ, I recently updated it to cover this.

  13. Hi Donncha,

    Whether or not it’s me I can’t say, but seeing other users with the same problem with files not being cached or not being served from cache (wordpress.org/support) as I reported here I decided to revert back to 0.8.9 (from 0.6.5 > 0.9.0) with my friends custom mobile browser detection. Added benefit is that I’m able to use full mode again. Here’s hoping a future version will enable full mode in conjunction with mobile browser support.

    Thanks for your continuing development of WP-Super-Cache!

  14. Thanks. Just talked to my host and they said they were not willing to add “mod-expires” to my server but I could do it myself. I don’t have the ability/knowledge to add the mod so my followup question is… am I going to run into problems without this mod? Should I be concerned?

    Thanks

  15. Thanks for replying. I’m reading and reading, but I don’t understand…it’s that parte right?

    == Custom Caching ==
    It is now possible to hook into the caching process using the add_cacheaction() function.

    Three hooks are available:

    1. ‘wp_cache_get_cookies_values’ – modify the key used by WP Cache.
    2. ‘add_cacheaction’ – runs in phase2. Allows a plugin to add WordPress hooks.
    3. ‘cache_admin_page’ – runs in the admin page. Use it to modify that page, perhaps by adding new configuration options.

    There is one regular WordPress filter too. Use the “do_createsupercache” filter
    to customize the checks made before caching. The filter accepts one parameter.
    The output of WP-Cache’s wp_cache_get_cookies_values() function.

    But how I do that?
    Thanks.

  16. List Guy – it may affect visitors who use IE, but if you use the plugin in half-on mode it’ll be ok.

    Tathy – See the question, “Why doesn’t Popularity Contest, WP Postratings or plugin X not work or update on my blog now?” The plugin really needs to use Javascript to count users.

  17. Donncha.

    I installed your development version today and followed all the steps to uninstall the old 0.8 version properly. My question is this. In IE, Chrome and Safari in full mode my website won’t even load at all. But it works in Firefox.

    Then I switched the plugin over to 1/2 mode, and all browsers work fine. Any clue as to what the problem could be?

    Thanks you can email me if you want…

  18. I really don’t know what to think now…

    The site loads fine in all browsers, BUT on my source code I’m only seeing

    on pages in the google chrome browser.

    All other pages I test I’m seeing

    No clue if this plugin is working right or not…and I wanted to add I installed the development plugin because my blog is installed in a sub directory instead of at the root of my server.

  19. Hi

    I’m on dreamhost PS and still trying to make it work. I had to revert back to version 0.8.9 because 0.9 seemed to use too much memory (I once the max memory set to 4000 mb and my site was down with internal server errors).

    The readme file says: Private Server users at Dreamhost should edit wp-content/wp-cache-config.php and set the cache dir to “/tmp/”…

    So i did this and now there is a folder named “tmp” in wp-content. I deleted the one name “cache”.

    My question is when you do that, do you have to change the rules in htaccess ? because there are a few lines mentioning the path to /wp-content/cache/supercache/ so should i change that to /wp-content/tmp/supercache/ ?

    Thank you

  20. Hi Donncha,

    I successfully installed the plugin on one blog but have been stymied on another that’s on the same server. I get the following message but when I implement it my blog crashes.

    Mod Rewrite rules cannot be updated!

    You must have BEGIN and END markers in /home/reviewme/public_html/.htaccess for the auto update to work. They look like this and surround the main WordPress mod_rewrite rules:

    # BEGIN WordPress RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] # END WordPress

    This message did not come up on the other blog, and the .htaccess did not contain this code.

    Thanks for your help

  21. Hi, first off – thanks for the great work on this plugin – it continues to impress.

    Now a bug. With the latest 0.9 set to status ‘on’, my homepage (after a while) starts serving cached versions of my archive pages. The only way to fix this is to regularly dump the cache or turn on to ‘half’. This has only happened since upgrading to the latest version and making adjustments as required.

  22. Hi Donncha!
    I’ve installed WP Super Cache on my site, with aprox 20K user/day.
    After activate plugin, my server has cached the pages but my server slow down! The log errors show this messages (a hundred times):

    PHP Warning: preg_match() [function.preg-match]: Unknown modifier ‘a’ in /opt/wwwroot/website/wp-content/mu-plugins/wp-super-cache/wp-cache-phase2.php on line 651

    PHP Warning: unlink(/opt/wwwroot/website/wp-content/cache/meta/wp-cache-/maurobeting539aff27fb7f50a75dd69451ff18397c.meta) [function.unlink]: No such file or directory in /opt/wwwroot/website/wp-content/mu-plugins/wp-super-cache/wp-cache-phase2.php on line 558

    PHP Warning: rename(/opt/wwwroot/website/wp-content/cache/meta/5315633304989a4630fa0d7.44555295.tmp,/opt/wwwroot/website/wp-content/cache/meta/wp-cache-/maurobeting539aff27fb7f50a75dd69451ff18397c.meta) [function.rename]: No such file or directory in /opt/wwwroot/website/wp-content/mu-plugins/wp-super-cache/wp-cache-phase2.php on line 559

    Did anyone run into this problem ? I appreciate your help in advance

    Thanks,
    Vinny

  23. Hi Donncha I installed supercache on my wpmu blog and it worked for a while but then I started to get 500 errors and had to disable it ….. thanks for a great plugin hopefully once I get time I can have deeper look…

  24. Vinny – I see you’re using MU, edit your wp-cache-config.php and add the following line at line 36, or anywhere after the if( defined( ‘VHOST’ ) ) {} section:

    $blogcacheid = str_replace( ‘/’, ”, $blogcacheid );

    I think the / in the filenames of your cache files is causing your problems.

  25. HI,
    I am trying to implement WP Super Cache. I added the MOD rewrite to the to the .htaccess file using the auto add/modify in the applaication setting page. I get a meesage syaing its all working ok.

    When I go back to the WP Super Cache settings page a few hours later no files have been cached as in the super cache. I left it a few hours and when i go back and there is a Mod rewirte error again.

    I would really like to use your app but having so many issue to get it to work correctly.

    Can you help?

    Cfadmin

  26. Can anyone help me with the problem i have ? Do I have to change the rules in htaccess ? How can i make this plugin work on a dreamhost Private Server. Please help…

  27. Donncha, thank you for your great plugin, once again. I love that WP-Super Cache now works together with WPtouch, however at least one thing is not working fine, I noticed. If you have an iPhone/iPod touch, please try it yourself in my site.

    On the bottom of the mobile page there’s a link so that the user can access the normal version of the site. THAT doesn’t work.

    Can you work on fixing that, please?!

  28. Rafael – I tried Alex King’s WordPress Mobile Edition plugin and it worked fine with the wp-super-cache once I added “iPhone” to the list of user agents in Alex’s plugin. Can you try to debug it yourself? I don’t have time to install wptouch as it’s a low priority for me.

  29. Donncha, there is no place in WPtouch I can add anything to the user agents’ list, however as the plugin was made mainly for iPhones/iPods touch, I think it already does that natively. Unfortunately I don’t have sufficient knowledge to debug it myself, I’ll have to count on you or the guys from BraveNewCode to fix that in a future version. 🙁

  30. How do I activate Super Cache within Windows platform. I’ve installed your plug-in and setup the configuration but to no avail, still no caching and check the ismyblogworking.com site and it shows no caching.
    • WordPress 2.7
    • PHP Version : 5.2.8
    • MYSQL Version : 5.1.30
    • Web Server: Microsoft-IIS/6.0
    • OS Server: Windows Server 2003
    Any suggestions?

  31. Hi Donncha,

    I have a suggestion for your plugin. If you add this htaccess rules, you can implement the “mobile mode” without disabling the WP-Super-Cache mode completely.

    RewriteCond %{HTTP_USER_AGENT} !^.*iPod.*$
    RewriteCond %{HTTP_USER_AGENT} !^.*iPhone.*$

    It might also need modification on the code in order to detect it’s an ipod and stop serving a normal WP-Cache page.

  32. Emilio – Thanks, that’ll solve for iPhone and iPod users but not all other mobile users. Maybe I’ll add that to the readme.txt or display it in an information message. Really, the user agent check should be the same as the list in wp-cache-config.php which is a lot bigger than the 2 above.

  33. Hi Donncha,

    I’m on dreamhost PS and still trying to make it work.

    The readme file says: Private Server users at Dreamhost should edit wp-content/wp-cache-config.php and set the cache dir to “/tmp/”…

    So i did this and now there is a folder named “tmp” in wp-content. I deleted the one name “cache”.

    My question is when you do that, do you have to change the rules in htaccess ? because there are a few lines mentioning the path to /wp-content/cache/supercache/ so should i change that to /wp-content/tmp/supercache/ ?

    Thank you

  34. Donncha, I use the iwPhone plugin, that’s why I just mentioned that Rules. But what I meant is, you should allow Full On mode + The mobile option, and not change it automatically to Half On

  35. Emilio – the plugin changes to half-on mode to avoid problems with people who don’t have those mod_rewrite rules which is basically everyone but if there are rules then that will have to change. The plugin *won’t* update the rewrite rules so if we go down this route, it will probably have to be manually done: I’ll remove the checkbox from the admin page and have a section in the readme explaining what to do.

    Teo – I think the cache dir should be “/tmp/” and the rules in the .htaccess obviously won’t work. Unfortunately Dreamhost use NFS for the web directory which is a bad idea when it comes to caching performance. You could also try symlinking /tmp/ to somewhere in your wp-content/. That might work.

    Louie – you need some sort of mod_rewrite module for IIS but I think the wp-cache caching should work.

    cfadmin – try enabling the debug feature in wp-cache-config.php, test with a browser with no cookies for your site.

  36. I’m having a problem. It doesn’t work at all, and I know the culprit. Apparently wp-ads a commonly used banner rotation plugin does causes every page to automatically expire, so no page can ever be cached. My only solution in the meantime was to directly cache the high-traffic pages (that got on the front page of digg) and only manually delete them when they needed to update now and then for comments.

    Is there any way to support the wp-ads plugin or is any other banner rotation plugin currently supported?

    Thank you for your time.

  37. I am running this on a windows server 2003 box and I upgraded and now my whole blog is down or something, not sure what is going on. Any help is appreciated. How can I just turn this thing off? I can’t access anything in any directory. Removing the files won’t do anything.

  38. One doubt here: I’m using the plugin in Half On mode with Mobile Support activated, but before I used it with Super Cache in ON mode. In this sutation I’m in now, don’t I need any rules added to my /blog/.htaccess file?! Because the plugin only says so if I change it to FULL ON mode.

  39. Can anyone assist with this error on my wp-super cache settings page?

    Warning: rename(/home/.sites/106/site15/web/blog/wp-content/cache/supercache/www.capperspicks.com.disabled,/home/.sites/106/site15/web/blog/wp-content/cache/supercache/www.capperspicks.com) [function.rename]: Directory not empty in /home/.sites/106/site15/web/blog/wp-content/plugins/wp-super-cache/wp-cache.php on line 820

  40. Great work Donncha.

    I wonder, would it be more useful if expiry is based on number of MRU (most recently used) entries rather than time? That was I can control how much I allow cache to grow at the same time, I can have indefinite expiry.

    Best,
    Yusuf

    1. Donncha, may be I was not clear. MRU scheme only applies to the garbage collection. Hence, it may not add complexity to the normal operation. I am somehow not very convinced with time based expiry of cache data and feel that MRU based scheme could be more effective. May be you will have better insight.

      Best,
      Yusuf

  41. Dear Donncha,

    I have a website with 3500 average visits. I wanted to enable Alex King’s WordPress Mobile Edition with WP Super Cache 0.9 perfectly.

    What is the best WP Super Sache 0.9 configuration for this condition?

    Best regards,

    firewalker06

Leave a Reply to Teo Cancel reply