Categories
WordPress

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.

Comments

comments

By Donncha

Donncha Ó Caoimh is a software developer at Automattic and WordPress plugin developer. He posts photos at In Photos and can also be found on Google+ and Twitter.

225 replies on “WordPress Super Cache 0.1”

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.

[…] WordPress Super Cache es un nuevo plugin para WordPress, encargado de realizar la misma tarea que WP-Caché, solo que presume de estar más optimizado. La labor de cachear las páginas más frecuentadas para no tener que andar consultando a la base de datos con cada visita, es una ayuda para aliviar la carga del servidor, sobre todo para aquellos que tenemos servidor compartido, o cualquier hosting con una alta cantidad de tráfico simultáneo. Si hay alguién que lo haya probado puede contarnos su experiencia, yo de momento me quedo con Wp-Cache. Quizás con un crecimiento de tráfico, me animaría a probar otras opciones. […]

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?

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

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!

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

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.

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!!!

Attivato WP Super Cache….

Se c’è una regola che vale su internet da sempre è che il visitatore vuole tutto subito (o quanto meno in tempi ragionevoli). Se un sito è scomodo da navigare o risulta lento a caricarsi, finisce per stancare e non esser visitato.
L’unic…

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!

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

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?

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.

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”

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.

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 🙂

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

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?

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?

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!

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

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.

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.

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!

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.

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.

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.

Leave a Reply