WordPress Super Cache 0.1

It’s time to lift the veil of secrecy on my latest project. With help from friends who diligently tested and reported bugs on this I can now present version 0.1 of WP Super Cache!

It is an extensive modification of the famous WP-Cache 2 plugin by Ricardo Galli Granada. This plugin creates static html files that are served directly by the webserver as well as the usual WP-Cache data files. It also goes one step further fixing a couple of bugs, adding some hooks and new features and making WP-Cache more flexible.
From the plugin page, here are some of the major changes and updates:

  • A plugin and hooks system. A common complaint with WP Cache was that hacking was required to make it work nicely with other plugins. Now you can take advantage of the simple plugin system built in to change how or when pages are cached. Use do_cacheaction() and add_cacheaction() like you would with WordPress hooks. Plugins can add their own options to the admin page too.
  • Works well with WordPress MU in VHOST or non-VHOST configuration. Each blog’s cache files are identified to improve performance.
  • Normal WP-Cache files are now split in two. Meta files go in their own directory making it much faster to scan and update the cache.
  • Includes this WP-Cache and protected posts fix.
  • Automatically disable gzip compression in WordPress instead of dying.
  • As Akismet and other spam fighting tools have improved, the cache will only be invalidated if a comment is definitely not spam.

If your server is struggling to cope with the traffic your site gets this plugin could be just right for you. If your site regularly gets hit by spikes of traffic like a digging or slashdotting it’s definitely the right choice, and even for everyday use, you may very well notice your webserver is a little bit more responsive.

I contacted Ricardo last week and sent him on an earlier copy of the plugin but I haven’t heard from him yet however. I’d love to know what he thinks of my modifications!

Update! this post has been dugg, please digg it and we can really test the cache out!

Nov 6th: WP Super Cache 0.2 is out! I think all the bugs mentioned below are now fixed. I applied Tummbler’s patch (from Elliott and Reiner) that enables gzip compression of the WP-Cache data files and fixes feed content types.
Please note: PHP’s internal zlib compression must be disabled for this to work. Look in your php.ini for the zlib.output_compression and zlib.output_compression_level directives and comment them out by placing a “;” at the start of each line.

Check the plugin page above for the download link.


You might also like

If you like this post then please subscribe to my full RSS feed. You can also click here to subscribe by email. There are also my fabulous photos to explore too!

225 thoughts on “WordPress Super Cache 0.1


  1. Well done! If i got it right, this is a fork of WP-Cache 2, improved in many ways. There is a hack around to enable gzip with WP-Cache 2 which IMHO helps but i’m reading that Super Cache “Automatically disable gzip compression in WordPress instead of dying”. Why is that?

    Im not providing the hack link just in case Akismet thinks im spamming :)


  2. Hello Donncha,

    Wow, this is awesome news! I am excited and a bit annoyed at the same time because just two days ago, I released a modified WP-Cache v2.1.2 on my brand new blog to enable caching and gzip to work together sensibly: instead of recompressing cached pages for every request with PHP or mod_gzip/deflate, compress once per page and save to disk. Now I’m going to ditch my work and try out your WordPress Super Cache, which is simply superior. :)

    Expect a pingback soon.

    /runs off to try this new toy


  3. I never could use WP-CACHE properly because my site is hosted on a Windows/IIS server rather than an Linux setup. As far as I can recall it was to do with the need for symbolic links in the install process and various other nasty bits that just don’t work under Windows in the same way

    Will your Super Cache work on a Windows/IIS environment?


  4. You still can’t use gzip compression with the regular wp-cache even in this plugin, but the super cache part of it creates index.html.gz files that will be served directly to the browser.

    Unfortunately I had to have that disabled by default because some servers didn’t deliver the pages with the right content-type. My servers run Debian and that’s fine, but a Cent OS server barfed on it. Comparing /etc/mime.types on both I see the Cent OS one has entries for gzip which the Debian file warns shouldn’t be there ..


  5. tummblr – I’d love to see your code! Would you mind emailing it to me?

    coyote – sorry, I don’t know if it will work or not. I expect it will as long as you copy wp-cache-phase1.php to wp-content/advanced-cache.php


  6. Donncha – You can find the modified files and the diff files here:
    http://www.tummblr.com/wordpress/wp-cache-gzip-without-excessive-cpu-overhead-yay/

    Most of the credit goes to Nick Georgakis and Reiner Saddey as cited in the post; I just cleaned up and merged the changes to the latest WP-Cache and added an admin option.

    The modification gzips and stores pages to disk so that future requests get the already compressed page on disk rather than an on-the-fly recompression (which is the result of most WP-Cache+gzip hacks/fixes on the blogosphere). But it still requires some PHP processing per page, one of the weaknesses of WP-Cache like you talked about. Your solution completely eliminates any PHP CPU crunching, so it’s superior IMO. Cache+gzip with your WP Super Cache should work fine too as long as we figure out the proper web server configs and/or .htaccess settings.


  7. I just removed WP-Cache and installed WP Super Cache with gzip compression enabled and all seems to be in order. Pages are loading faster than ever!

    You seemed to have fixed/changed(?) an annoying behavior of WP-Cache’s: since by default WP-Cache is set to not cache pages with “wp-” in the URL, it also refused to cache my blog post that had “WP-Cache” in the title and thus the URL. WP Super Cache is caching that page happily.


  8. I’m giving it a go on my site. Good work, Donncha!

    A few notes:

    It looks like your readme.txt has a UTF BOM, which is preventing the WP plugin page from displaying it as usual.
    When I first activated it, I also tried to enable gzip at the same time, and got an error about the prune_super_cache() function being undefined. Turning it off and on after that point did not re-display the error.
    The installation instructions say to remove the WP_CACHE define. But it’s required, and the FAQ says you need it.
    Feeds get served up as ‘text/html’, and not with their correct content types.
    When you disable compression, you get a message about disabling a subset of the rewrite runes in your .htaccess. But with the rules listed in the readme, it doesn’t appear to be necessary to remove them. The rules stated in the readme should be fine (with the caveat about running WP out of a subdirectory requiring rule modification)


  9. I would love to try this, but since my blogs are hosted on Windows/IIS, I’m pretty sure it won’t work. Anything that depends on rewrite rules won’t work on IIS unless you install a 3rd-party app (don’t remember the name at the moment, but it’s an add-on you can buy). IIS requires that index.php be part of the URL without the add-on.

    If you ever get a chance to work out the issues on IIS, I’d love to try it.

    Thanks,
    David


  10. Dougal – thanks for the great report.

    WRT feeds I can do two things, either not cache them (boo!) or add an “addContentType” or similar declaration to a .htaccess files that may fix it.


  11. Any improvements on the “keeping parts dynamic” side ? I’m not sure I understand the purpose of do_cacheaction() and add_cacheaction().


  12. Installed and working like a champ. I have had the odd one or tow times that I got dugged and it killed my site – hope the next one comes soon to try this snazzy piece of code out!

  13. Pingback: Tummblr

  14. Hi, I just installed your plugin, but I’m not sure if it’s working or not. It installed fine and I enabled it, but it just says 0 cached files for both WP-Cache and WP-Super-Cache! So not sure what’s up with that?? I’m guessing it’s not caching since it has 0.

    Any ideas on how to fix this? I’m running WordPress 2.3.1 and I uninstalled WP-Cache and deleted all the files.

    Thanks


  15. Hi,

    I’m really interested in this plugin since my shared server can’t handle so much database queries at the same time. For example, only my front page is about 50 queries.

    Now here comes the stupid question. With this plugin, will it reduce the queries? I suppuose so, but how much aprox?

    Thanks in advance.


  16. I am running WP 2.3.1 … I get:

    Fatal error: Call to undefined function: do_cacheaction() in /home/17740/domains/scottjanousek.com/html/blog/wp-content/plugins/wp-super-cache/wp-cache.php on line 171

    Not sure where this function is supposed to live. I tried searching for it … but couldn’t find it.


  17. tried it.

    Canned it and went back to WP-Cache.

    Why?

    When I enabled super-Cache, the little images on my Template, stopped loading properly.

    so, I went back and everything is fine.

    Sorry. :(

    -Chuck


  18. Donncha-

    This is sooo exciting! I have contemplated programming a new WP-Cache for quite some time, but I’m not good enough at PHP. This is exactly what I’ve been waiting for.. Thank You!

    See my wp-cache hack, maybe some good ideas about what http headers to send.


  19. My host changed their system setup (re permissions) during a security upgrade (don’t ask me what exactly) after that wp-cache stopped working altogether. Going to give super cache a try…

    …will report back

    db


  20. The zip file has been updated (even if the page says 0.1) and I have fixed most or all of the bugs above.
    I applied Tummbler’s patch and yes, it works beautifully:
    1. If compression is enabled, then logged in users see compressed WP-Cache pages now.
    2. I disabled super caching of feeds and WP Cache should return the right content type.

    The “function not found” errors Dougal found should be gone now.
    Fixed a small bug stopped WP-Cache creating new files when the Super Cache was disabled.

    You can also get the newest code from http://svn.wp-plugins.org/wp-super-cache/trunk if you’re familiar with SVN.


  21. This sounds as a great plugin, but I am wondering if I can use it on my website.
    My chess Teaching website has some posts (with mate in 1, mate in 2, mate in 3 and other exercises) that are supposed to be different each time a user visits the site. The other posts can be cached.

    Is it possible to exclude caching for some of the posts?


  22. Hi,

    i`ve changed from wp-cache to your super-cache plugin and it works really great! Thank you for your fantastic plugin. Why don`t you just change the version tag in csv? :)

    What about mfunc? Like wp-cache? Or dynamic adsense code.. how can i make it? (and semmelstatz to work with referres..?

    Have a nice day

    sara


  23. OK, a couple of glitches for me.

    I downloaded the 0.2 zip, but it still reports as 0.1 in the plugin file so I’m not 100% certain I’ve got the latest.

    When I activate it, it works great apart from pages for form submissions where it actually shows/breaks the form action, instead of hiding it behind the buttons IYSWIM (look at the form at the bottom of http://bytor.co.uk/faq and you’ll see bits of the action listed above and below the form boxes/button.

    Finally, in the “rejected URIs” box, I’ve put some entries, but it ignores them and caches matching pages anyway. I put in “/faq” then changed it to “faq” and it still caches the page http://bytor.co.uk/faq but never supercache, only wp-cache according to the comment line in the source.

    Or am I misinterpreting stuff?


  24. Sara – look at the plugins/searchengine.php as an example of how to make the cache less efficient and make it target referrers. Unfortunately plugins that rely on php code being executed on every request won’t work correctly, but you can always disable the super cache part of the plugin, leaving regular wp-cache.

    Graeme – the first bugs are strange. The cache shouldn’t affect your comment form. What plugin is that? I added a check for .php to the rejected URIs which is why your faq was still cached. Otherwise “wp-” matched stories and pages starting with “wp-”. That needs to be more sophisticated.


  25. I checked through ALL the forms and it does only seem to be the FAQ which is affected. The plugin for that is FAQ-Tastic http://knowledgeconstructs.com/wordpress-plugins/faq-tastic/

    If you could get the rejects to work that would be great. Even something like a wildcard or symbol put at the start of it so it would grab every version of that URI would solve it. So perhaps putting each URI as “*/faq” if you want it to work on every version and just “/faq” to do the conservative version you already have? That logical?


  26. Hey Donncha, awesome work!

    Any idea if this requires Linux (like WP-Cache2 did/does) or if it’ll work anywhere PHP runs (like Matt’s original Statictize plugin)?

    (Assuming an environment with PHP, MySQL, mod_rewrite, and write access to local folders)


  27. CG – it uses the same symlink code that WP-Cache uses so it might cause a problem for Windows boxes. It shouldn’t be much of a problem checking that we’re running on a Windows box and copying the wp-cache-phase1.php file instead of symlinking it.

    I don’t have a Windows box handy to test it though.
    PS. I *love* your xcache plugin. When not serving static files, this server hums along nicely with it.


  28. Donncha,

    Any reason why the number of cached pages keeps showing up as 0?? Everything seems to have installed correctly, but the number of cached pages in the Options panel is always 0! Any ideas?

    Thanks


  29. Aseem – have you checked your cache directory? Also, the cache is disabled by default, it has to be enabled.

    You should also click the “Regenerate stats” button to force the stats to update. I don’t do it on every page load because it has to iterate over sub-directories and could be too heavy.


  30. Donncha,

    I checked the Cache directory in wp-content/cache and it has only cache files from yesterday (before I turned on wp-supercache. It doesn’t have anything after that in the cache. I also went to the Options and I do have it set to Enabled. I do not have Super Cache Compression enabled though. Still everything is 0 for both WP-Cache and WP-SuperCache!!! I might have to switch back! I would really like to use this though, please help! Thanks!

    Should I delete the cache folder and see if that might be causing the problem since it was already there???


  31. so as long as i have mod-rewrite (which i do) it will work just fine? i would love to test it, but the site i would like to use this on is very busy and i can’t test on it. :/


  32. Okay…. Where’s PHP.INI?

    I use cPanel here for my hosting and I was using the file manager and I cannot find PHP.INI

    Before anyone laughing, I’m freakin’ new to this stuff… so, go easy on whitey…

    -Chuck


  33. donnie – it’s recreated and added back in when you install the new plugin.

    Chuck – you probably don’t have access to it as it’s generally “root” who edits that. You can still use the plugin however, just disable compression. If PHP is already compressing things then that’s good too.

    I’ll need to add another radio box and separate out super cache and wp-cache compression.


  34. Donncha,

    I still can’t seem to get any pages cached! Everything was done correctly…enabled…etc, but nothing is being cached by either cache method. Something is definitely wrong! Any ideas? I explained more in the comment I left a few mins ago.

    Thanks


  35. Aseem – have you updated your plugin since yesterday? Download the zip file from the page above and install that. Never mind that the version number on the WordPress.org page says 0.1, I messed up the readme file when I was making the release!


  36. Chuck – you probably don’t have access to it as it’s generally “root” who edits that. You can still use the plugin however, just disable compression. If PHP is already compressing things then that’s good too.

    It was, the graphics on my template were not loading… I couldn’t figure out why… anyhow, I’ll just stick to Wp-Cache.


  37. (RE: Windows linking stuff, it is apparently possible to produce a good approximation to symlinks on modern Windows. You do need a special tool from MS to do so, though, so it may not be too practical…)


  38. I just installed the new version. It works fine. for one, I didn’t have my gzip compression turned on, on wordpress, because the old plug in said I had to disable it. So, I turned that on. and installed the new one, and it’s working great, compresson and all.. I also added said stuff to the .htaccess file as well. everything seems to be humming along now. :)

    -CHuck


  39. Donncha,

    Thanks for taking the time to create this plug-in. I tried installing it an hour ago and it asks me to set WP_CACHE to true, which I do. When I do that, my entire site disappears and loads (and reloads) blank. Any thoughts on that?

    thanks!


  40. Not at all, not at all. I have found, however, that very popular WordPress blogs where the owner is using wp-cache but not some memcached magic are intolerably slow, in general…


  41. o, basically, you’re turning it into Movable Type?

    I got news for you man, WordPress smokes Moveabletype’s Butt any day of the week. MoveableTypes doesn’t even acknowledge WordPress’s trackbacks for Christ’s sake!

    Moveabletype is for idiots who have more money than common sense, give me wordpress any day of the week. Even if Matt is a butthead. :-P :-O :lol:


  42. *shrug*

    My MovableType blog must be special; it’s fine with WordPress trackbacks.

    Seriously, though, Donncha, well done on this. It seems to remove the single biggest issue I had with WordPress, and what drove me away from it in the first place. Any chance of getting it in the distribution?


  43. *shrug*

    My MovableType blog must be special; it’s fine with WordPress trackbacks.

    Ya know, I might be thinking of typepad or something, I’ve sent trackbacks to moveabletype blogs before, and they never showed up. I believe that with typepad, you have to send them too the proper place or something odd like that. With WordPress, you just have to reference the link in question and bam, it shows up. Or could have been the guy wasn’t accepting them. So, I could be wrong. :D

    Think I like about WordPress is, IT’S FREE! AND FREE IS VERY GOOD!

    Especially for us poor white folk! ;)


  44. Robert – thank you. No chance of it going into WordPress. As you can see from comments above, it doesn’t work on all servers. Cent OS servers in particular don’t like the compression code but I’ll fix that one way or another.

    WordPress is getting much better caching now. The xcache plugin I linked to above is superb and comes very close in performance terms to the static file being served to anonymous users here. Ryan Boren is working on a caching module too, so WordPress 2.4 could be pretty sweet from that perspective.


  45. Having a problem (I think). When I hit the Delete button on an expired cache page it deletes all of the cached pages.

    I would not think this was expected behavior as each page has its own delete button.

    Any info/suggestions?

    Thanks.


  46. WindowsObserver – you mean on the “List Files” part of the admin page? That’s something I haven’t looked at yet tbh. Thanks for reporting that.


  47. Dreamhost didn’t like the Super Cache compression. It gives you weird characters when you have “super cache compression” enabled.


  48. I’ve been using WP-CACHE for a while and have fund it to be a lifesaver when my site has a post go Digg popular. But even then, there are limits — if the traffic from Digg is too much the site still hangs…

    The other issues fixed (gzip, etc) aren’t really of interest to me since really. The only thing of value is if the caching is actually faster.

    Should I make the switch? Is it really a significant caching improvement? I’d hate to make the switch just to find that the caching itself is basically the same…


  49. Darn!!! Thank you for this… just one question: How can some portions of the static page still be kept dynamic using your plugin? I’ve been dying to get something where certain plugins I use can still be kept dynamic and not cached like: the Recent Comments Plugin, the wp-views plugin – the views plugin in particular, cache plugins are great but features like number of views of a post get massacred… is there a way to include some generic features where WP users can include such plugins not to be cached or cached until any change occurs (like views get changed etc.)


  50. Oh yes, this post is on the front page of Digg.com and the server is barely ticking over. That said, it’s been a *very light* digg with only 2000 hits in the last hour and a bit.


  51. Oz – you could now write plugins that clear the cache when your various dynamic plugins should be updated, or use Javascript to fill in the space on your page.

    21st C – why not give it a go? It’s not as if you have to pay for it!


  52. 21st Century Citizen,

    Yes, Yes and Yes.

    Switch now, you’re Blog will love you for it. Just be SURE and follow the instructions!

    I didn’t the first time and I had a problem. :roll:

    But it works fine now!

    -Chuck


  53. Donncha, thanks. Unfortunately I’m not a programmer to understand what you just mentioned ;) Is anyone working on integrating wp-views and recent comments plugin with Super Cache? It would be nice to see a step by step process for non-techie bloggers like me :)


  54. I’m getting a nice little error…

    Fatal error: Call to undefined function do_cacheaction() in /home/user/public_html/wp-content/plugins/wp-super-cache/wp-cache.php on line 172

    any ideas?


  55. Jonathan – symlink wp-content/advanced-cache.php to wp-cache-phase1.php if it’s not there. That error will hopefully only show once right?

    I’ll wrap that in a function_exists() call for the next release. Thanks!


  56. Rob – expire time can be any time you want. Super Cache is set to 6 hours by default, but it all depends on how often you want dynamic elements of your site to update.
    When you make a post or a comment is left the cache updates, but things like “latest comments” widgets won’t on every page.


  57. I am a little confused about compression. In Options, should I be enabling compression? If so, do I need to comment out zlib in php.ini as indicated by this page (but NOT talked about at all in the README)? What’s the story?


  58. sygyzy – Yes you should enable compression in the admin page, and yes you should remove it from php.ini

    It’s not in the readme because that feature was updated this morning and I didn’t see that my photoblog, http://inphotos.org/ was displaying actual gzip content, and then it took me about 10 minutes to figure out it was PHP’s internal zlib compression. This site wasn’t affected because that wasn’t enabled. Unfortunately that was after I made the 0.2 release. I hope I can follow in a few days time with a minor 0.3 update with a corrected readme file.


  59. Donncha,

    I downloaded the latest version and uploaded it and STILL HAVE 0 CACHED PAGES!!! There is something really weird going on here. Any ideas on what this could be???

    Thanks


  60. Donncha,

    I have not touched my php.ini and I have compression enabled and I don’t see anything broken. Is there any sort of debugging feature to see what’s going on behind the scenes? I will make the php.ini change like you said but I don’t see any ramifications without it. It certainly does not seem to be breaking the caching.

    Thanks.


  61. I’m not sure what I’m missing. I am using wordpressMU 1.3. I decided to install the plugin to the plugins folder to test, but when I go to the options page I can only see:
    WP Super Cache Manager
    Main options

    and nothing else. No check boxes or error messages either on the screen or in the php error log. Also, none of the cache folders are created. Any ideas?

    Thanks


  62. I installed the new version, but I still get ‘text/html’ on feeds, even with the flush() call added when trying to get the headers.

    I really think the only sure way to fix it is going to be to check is_feed() in wp_cache_shutdown_callback(), like in my old patch:

    http://dougal.gunters.org/blog/2007/06/19/wp-cache-fix-for-content-type-in-feeds

    However, don’t use that patch as-is, because yesterday I applied that to your code, and my testing turned up that the ‘feed’ query variable isn’t set in the default case (when a specific feed type of ‘rss’, ‘rss2′, or ‘atom’ isn’t requested). How about I just go ahead and submit a revised patch in the plugins trac?


  63. I’ve tried the WP Super Cache, and all appeared to work smoothly until I viewed the site in IE 7 where I saw all sorts of “MySQL server has gone away” errors. I’m using WP 2.3.1. Any thoughts? Anyone else experience this issue?


  64. How do you exactly go about using the do_cacheaction().
    I’m hoping 0.3 will have a readme that’ll be kind to php newbies like me


  65. Love it already! Options are just right as well. Thanks for the hard work, I dugg it.


  66. Just tagged 0.3, phew.
    Changes:
    1. Fix feed content-type, props Dougal
    2. Check the do_cacheaction() exists in wp-cache.php
    3. Copy file if symlink is not found
    4. Move WP Super Cache to “Site Admin” menu on WordPress MU
    5. Don’t compress WP-Cache data files is PHP is already doing it

    Hopefully fixed the version number on the WordPress.org page!


  67. how can i be sure this is working properly? i’ve followed the directions step by step. i can see cache pages increasing, but not super cache pages.


  68. I’m getting the following message on the options page:

    “Install is not complete. Please delete wp-content/advanced-cache.php”

    But when I delete the file, my site blows up until I restore it.

    What am I doing wrong?


  69. You should read the how it works section… Super Caches are only created when people who aren’t logged in view a page from what I can understand.

    By the way I was wondering, a caveat is that someone who is if you’re logged in or write a comment, but what do you mean by this? Do you mean that you won’t use the benefits of Super Cache? Or does it mean that if you post a comment it won’t update and will appear as if it wasn’t posted until the cache expires?


  70. sorry for the constant posting. i view the site not logged in and view the source and i see this.


    in the wp-super-cache admin screen i see this.

    WP-Cache
    * 497 cached pages
    * 44 expired pages

    WP-Super-Cache
    * 1219 cached pages
    * 0 expired pages. (Generated 22 minutes ago. Refresh in 38 minutes.)

    so obviously super cache pages are being created, but i am not seeing any of them served.

    http://www.everydayshouldbesaturday.com

    can someone verify if they see the super cache pages being served?


  71. @donnie

    I was under the impression that you weren’t supposed to have WP-Super-Cache and Super-Cache active at the same time? (Step 2 of the installation instructions in the readme.txt file)


  72. @donnie

    ugh, apologies – I’m totally off-track

    as for my own problem, it seems to be fixed. Fiddling with the permissions on advanced-cache.php seems to have fixed it :)


  73. Thanks, Donncha :)

    Symlinks shouldn’t be a problem, w/ WP-Cache I took care of them by either copying the file directly or by creating a hard link to the target.

    WP-Cache had some weird problem (that shouldn’t have occured) that I wasn’t able to pin down when creating the .meta files for posts so that it ended up “caching” the page each time it was viewed. It worked just fine for index pages and feeds though.

    I’ll give this a shot and let you know how it goes :)


  74. Looks great and I’m considering replacing WP-Cache with this on my site — http://www.finalgear.com/

    We don’t have load issues or anything due to an uber box, but it’d still be nice to optimize further to keep more CPU available.

    However, I have a question: The point of this plugin is to go completely static, right? I ask as I have a part of the site that’s currently dynamic and generated via a little databaseless PHP.


  75. One more comment. Just got everything running. For the most part, it’s awesome. The only thing causing a bit of trouble is the Rejected URIs part of the config page. No matter what I enter, it still caches every page, even if they contain one of the listed strings. (I did save them so I know it’s not that.) IT creates a problem only because I have several tools pages that need to update via PHP each time it loads. Any thoughts on why that might not be working and how to fix?


  76. I’m having the same problem with Rejected URIs as WebGeek. It looks like everything is getting cached and super-cached whether they are in the exclusion list or not.


  77. Fantastic plugin Donncha. Page load time here is amazing considering front page digg. Installing on a few blogs already and is working a charm. A shiny penny for you. :)


  78. good :)

    mh.. maybe it should check if apc cache or eaccelerator is installed and use it for caching? and if both are not installed on the sys, just go ahead like usuall wp-cache/super-cache?

    just a stupid idea..sorry.. and i dont know if it would improve caching using apc or eaccelerator functions..

    have a nice day :)


  79. how does this determine whether or not you have made a comment? is it only per post or if you make 1 comment then you get regular cache the rest of the time? i understand if you are logged in … so i used a different browser and made sure i wasn’t logged in but still get the regular cache, nothing from super cache. maybe it’s something with the .htaccess since i am not using the fancy permalinks.

    http://www.everydayshouldbesaturday.com

    can anyone see the super cache pages?


  80. RE my earlier question:

    I went ahead and moved a dynamic PHP header to a JS image picker and switched the leftover PHP dynamic stuff being called via AJAX. So the page won’t be completely PHP free, but I think WP Super Cache + a little AJAX is better than WP-Cache’s silly includes.

    mh.. maybe it should check if apc cache or eaccelerator is installed and use it for caching?

    That wouldn’t work as you’d have to load up PHP to fetch the files from the cache engine, at least from my understanding. Defeats the purpose of this plugin.

    However, you can tell your cache engine to cache the “cache” folder to RAM and serve it up from there rather than your hard drive. I’ve done that on my site with WP-Cache for quite a while.


  81. Viper – I wonder if we’ll see the rise of Javascript widgets again if this plugin becomes more popular?

    donnie – WordPress has a “hook” that is executed each time a comment is left. That hook clears the cached file for the post the comment was left on, and also clears the main page’s cached file too, just so widgets get a chance to refresh and fix comment counts.
    I only see WP-Cached pages, no the “super cache” string in your footer. Check your wp-cache-config.php, your .htaccess and finally your cache directory!

    tomás – WP’s internal caching is a whole different beast. It’s completely separate. They don’t interfere with each other at all.

    Sara – using memcached to store the cache isn’t such a bad idea. I know a certain *large* WordPress site that does that, but they have dedicated 4GB memory servers for that task!

    Lincoln – it should work, I hope. Give it a go!

    Michael Feldstein – make sure the advanced-cache.php link points at the wp-cache-phase1.php in the wp-super-cache folder, not the wp-cache folder!

    Jorge Peña – if you’re logged in or leave a comment, you’ll always see WP-Cache generated content. If you delete the WP cookies you’ll see the static content again!

    Dougal – yes, must fix that. Also the list doesn’t reflect what’s stored in the super cache.

    sylv3rblade – look at plugins/searchengine.php for an example plugin that uses those actions.

    I installed a “paged comments” plugin but it’s annoying. I like that the newest comments are on the front page, but I’d prefer if they were in descending order. Hopefully that can be done. I need to look at the config file again.


  82. Donncha: yeah, i know they’re a whole different story. but I remember there used to be problems between WP-Cache and WP’s object cache. just as there was a bug using WP-Cache together with APC… or even with some plugins, such as Democracy.


  83. k, the config file was completely different, so i replaced it with the new one, made the changes. still no super cache pages. i did notice one thing i think should be changed if you are not using fancy permalinks … every where it says %{HTTP_HOST}/$1index i changed to %{HTTP_HOST}/$1/index because fancy permalinks contain a trailing slash where the default doesn’t.


  84. Not knowing how to do a symlink, I copied wp-cache-phase1.php to the appropriate folder and renamed it “advanced-cache.php”. However, when I open that file, I find that it’s empty. Sorry for the dumb question, but how do I get the file to “point” to wp-cache-phase1.php?


  85. Hey, great plugin, I tried running it on my site for a while and it really sped things up. Unfortunately I had to disable it because when I was working on the site I started to notice that whenever I would reload a page something would go wrong and i’d be served a blank page, upon refreshing that page I’d then get the correct page. Reload that -> blank page… so on and so forth. I tried disabling compression and it just turned that blank page into a 500, but still the 50/50 proper page / blank(500) page.

    What’s weirder is that this only happened in Firefox and stopped happening once I disabled the plugin and uncommented the .htaccess mods.

    Oh, this was in 0.3 and 0.3.1.

    shoot me an e-mail if you need any more info.


  86. I am running Windows with IIS 6 and it seems that the caching is working, but the admin options page for wp-supercache is just a blank white page… no options at all. I have followed everything in the readme.txt file – anyone else have this?


  87. Hi Donncha,
    I have to say that you … broke my heart :-) … when I saw that you mentioned everyone else in your post except , myself, in the people who have worked on WP-Cache .

    Just joking of course – that’s the beauty of open source , a lot of people make most of the hard (and exciting ) work first and all the credits go to those who ” pretty package” do the (boring) job of polishing things up to share them with the rest of the community…(I DO NOT mean you of course) Thanks for doing this service to the WP community!

    You seem to have done a very interesting job (It’s a pitty I am currently involved in Semester exams and can’t take a more detailed look in it) so I will have to delay further / more technical comments

    I am mostly interested to see how you have managed to implement gzipping of pages including parts that need to dynamically update each time the page is loaded , cant get it right now how the hooks are called from the gzipped file!

    The dynamic content problem has been puzzling me for long and kept me from releasing a “Shrink wrapped / ready to install plugin” gzip enabled version .

    I am very happy seeing that someone better than me has managed to tackle it!!

    Best Regards,
    Nick


  88. It seems that there is a vulnerability in the plugin. Several people on twitter mentioned it (factoryjoe as the first) and I just deactivated and copied my cache over just to see that half my server was mirrored in the supercache folder. The vulnerability seems to be injection of .txt files as parameters which don’t get filtered out before the cached files get written!


  89. Another issue that’s come up…some pages are being cached and so are the credentials for comments. Actually, the comment form says logged in as Administrator even if you open it from a different computer that has never loaded that page before. Looks like when it cached the page, I must have been the first one to view it while I was logged in and therefore it cached that.

    Any way to fix it so that it does not cache the logged in version of a page?

    Thanks


  90. Darn, I was hoping this would fix my problem with WP-Cahce, but it doesn’t. I used Goddady shared hosting, and when I use this plugin (or WP-Cache) I get a 500 internal server error.


  91. Donncha, I’ve sent you an email about making the code Windows-compatible, just a few minor changes; with a couple of non-Windows-related bug reports as well.

    For people looking to run WordPress Super Cache on Windows in the here and now, here are the steps: http://neosmart.net/blog/2007/getting-wordpress-super-cache-to-run-on-a-windows-iis-or-apache-server/

    Runs on both IIS and Apache on Windows.

    I’ll be benchmarking it soon!!!


  92. Great plugin! I have tried it and it looks like something I would definitely use. However, one thing I’ve noticed is that my ajax rating images will never be updated while the cache is generated. Is there a workaround for this? The rating plugin is called Wp-PostRatings

    Thanks!


  93. Chris and I are exchanging emails and trying to figure out where his server was exploited. The Super Cache plugin will cache the path of the exploit filename, but it stores the 404 message or whatever WordPress displays.

    If anyone finds files from outside their webserver path or blog stored in the wp-content/cache/supercache/ folder then please contact me immediately at donncha at ocaoimh.ie


  94. I don’t know how to create a symlink, is there any other way I can fix the error that says “advanced-cache.php link does not exist”?

    The FAQ in the Readme says “copy the file”

    What file should I copy to where?


  95. John – copy plugins/wp-super-cache/wp-cache-phase1.php to wp-content/advanced-cache.php
    I thought that was pretty clear from the rest of the sentence. I’ll try to make it clearer.

    Is there a wp-content/advanced-cache.php ? If not, then you must symlink wp-super-cache/wp-cache-phase1.php to it with the command while in the wp-content folder. ln -s plugins/wp-super-cache/wp-cache-phase1.php advanced-cache.php If you can’t do that, then copy the file. That will work too.


  96. I copied ‘wp-cache-phase1.php’ to the ‘wp-content’ folder and renamed it advanced-cache.php, but I still get the error saying “advanced-cache.php link does not exist”


  97. When one switches themes the cache is cleared using the ‘switch_theme’ action but when the widgets on the sidebar are changed the cache isn’t being cleared. I could not find an action for that.


  98. Elad – that’s bad! There must be an action we can hook into to clear that cache. I’ll take a look too.

    John – That’s strange. Did you have WP-Cache installed before? The error shows up because the do_cacheaction() command wasn’t found in the advanced-cache.php file, which means the wp-cache-phase1.php was copied from the original WP-Cache.

    Nick Georgakis – please accept my apologies for the oversight. I saw your name in a patch but because I was under a lot of pressure I didn’t look for your blog and then forgot to include your name in the Changelog. And no, when a file is cached as a static html file then there are no dynamic parts. The best thing to do for dynamic content is use Javascript like in the good ol’ days of sitemeter :)


  99. I’ve never used WP-Cache. This is my first time installing any caching.

    By the way, I’m using WordPress 2.3.1 on Linux/Apache


  100. So have the possible php injection vulnerabilities been confirmed/fixed?

    I was just getting ready to install this when I heard about the possible problems.

    Any news?


  101. JimmyJoe – I’m fairly confident it’s not a vulnerability, just a small bug that created the supercache directories in the wrong place.


  102. I have a few questions about the WP Super Cache options page.

    I see that there are separate options for WP-Cache and WP-Super-Cache, which pages get cached by WP-Cache and which pages get cached by WP-Super-Cache?


  103. Good work on your plugin, thanks. I am also getting a problem where a previous commenter’s name is cached on a single post page. The preg-match doesn’t like forward slashes in the excluded strings box… i.e. when you use /2007/ as in the example above the box. Thanks!


  104. RobotDan – are you using my friends adverts plugin? Or have you enabled that plugin the super cache admin page? The next release will have a fix for a minor bug that might cause what you’re seeing.

    Donncha


  105. Hey this is one of the most useful plugins I’ve come across! I just built a website for a large company that gets TONS of traffic and this saved the site from time outs and blank pages… just one question – will this effect pageviews from a statistics point of view? Someone I work with had told me he installed a cacheing plugin on his WP blog (not this one) and he said that the cached pages were not counted in his pageviews from his stats program? I just want to make sure that this isn’t the case for this plugin.


  106. Lindsey – if you use a stats program that uses Javascript to count visits then you’ll be fine.

    RobotDan – can you try and debug it and figure out a pattern? Leaving a comment should remove the previously cached page.


  107. Hi there Donncha,

    This is an exciting project for me! I really look forward to trying it out and hopefully getting more from my server.

    Do cached pages require any database queries? I ask this because my hosting has a SQL server on a different machine, so database queries can be slow due to network congestion – even on simple selects. At the moment my page render times are about half a second on average – will your plugin cut this down?

    Also, can you specify cache life? I’d set mine to about 6 hours or so maybe to reduce database activity to a bare minimum!

    Thanks for all your hard work on the WordPress platform!


  108. CalonDdraig – sounds like the perfect fit for you. Static cached pages don’t make any db queries but when someone is logged in or left a comment then caching is handled by WP-Cache which means PHP is loaded. If a cached file is found then no, generally there are no db queries.


  109. Donncha,

    Is it possible to use the wordpress search using Super Cache? When I try to search on a Super Cached page I’m taken back to the index. When I’m logged in and search and the page is served with WP-Cache, it works.


  110. Vic – if you try the development version of the plugin you should hopefully find that searches work again. They won’t be “super cached” but they will be cached by WP-Cache.

  111. Pingback: WordPress 2.3.1

  112. Thanks for the good work. I was running WP-Cache fine with GZIP mod, but with Super Cache I get the “save the page” prompt in Firefox. How come GZIP works for me flawlessly with the mod WP-Cache but Super Cache makes Firefox prompt to save the page?

    This shows the compression issue it’s not with the server configuration (again WP-Cache modded to serve GZIPed pages was working flawlessly), but with Super Cache.

    Any ideas are very welcome, I really want to use Super Cache but need compression.


  113. Hi Doncha,
    Thanks for the great plugin.

    I have a slightly off-topic question, but I saw your post about memcached on wordpress.org.

    I using the object cache -> memcached replacement files from http://dev.wp-plugins.org/browser/memcached/trunk and I’m not sure how to set the memcached cache to expire. I’ve tried adding an expiry in wp-config but that isn’t working.

    Do you know how to reset the expiry time of the cache? I’ve got memcached working via a slave server but nothing I try works to expire the cache.

    Thanks again!


  114. elio – you set the cache time when you call wp_cache_set/add/update, otherwise the default is used. Can’t remember where that default is, but it’s an hour AFAIR.


  115. Hi Donncha,

    WP Super Cache is a great plugin, I use it since I set up my blog.

    But I found cache the whole pages is not aways that necessary, so I write a new cache plugin WP Widget Cache, which can cache the output of blog widgets. I think it’s a plus for WP Super Cache, and will significantly reduce the cost for WP Super Cache to cache new pages, especially when Google is crawling the site.

    Here’s the plugin url:
    http://wordpress.org/extend/plugins/wp-widget-cache/

    Looking forward to hear you thoughts.


  116. Hi,
    I have been kindly left (had dumped on me) a website which has started displaying an error “Parse error: parse error in /html/news/wp-content/plugins/akismet/.wp-cache.cache.php on line 1″. I am a software developer but I have no experience in PHP and I am unsure of where to start.

    If you could provide any pointers as to what the problem might be that would be greatly appreciated.

    Thanks in advance.


    1. Declan – delete the file or move it out of the way, that shouldn’t be in the akismet directory. Your site may have been hacked. Look for the WordPress Exploit Scanner to do a scan.


      1. Hi,

        As a temporary measure I rename the akismet directory and the problem has gone away. I will investigate further as to security of site.

        Thanks for your help.

Leave a Reply

Loading Facebook Comments ...