Website rework progress #2

November 16th, 2006

Well, I haven't sorted out the IE7 problem yet, but I have found a fix for the load speed problem. It's a plug-in called wp-cache. You can get it here:

http://mnm.uib.es/gallir/wp-cache-2

Installing this plug-in has taken my time-to-load from 25+ seconds to just 3”“4 seconds, which compares very nicely with the performance I was getting from Plone. It does this by caching pages on the server so that preprepared HTML pages are served up to your browser, rather than dynamically generating pages on request, using PHP. You can check that you're looking at a cached page by viewing the source of the page. If it's a cached page, the last line of the source will be:

!-- Cached page served by WP-Cache --

Two installation methods are documented. I chose the manual method, just because that's the one everyone seems to talk about, so I reckonned I'd stick with tried-and-tested. Installation is a little more difficult than installing most WordPress plug-ins. But if you're used to ploytering around on a UNIX command line on your Web server you'll find it easy enough.

There are 2 little problems with this plug-in that you must watch out for. Both of these cause your site to serve up completely blank pages after you install the wp-cache plug-in.

  1. If you're server uses PHP 5 you need to edit /wp-content/plugins/wp-cache/wp-cache-phase2.php, locate ob_end_clean(); in this file and replace it with ob_end_flush();That is, you need to change "clean" to "flush".
  2. Don't use the documented command for creating the symbolic link. I copied and pasted it onto the command line and it created a duff symlink. The correct command, from the wp-content directory is:ln -s plugins/wp-cache/wp-cache-phase1.php advanced-cache.php

Once you've sorted this out and added the define statement to your wp-config.php, you can go to the Options section of the WordPress admin and you'll see a WP-Cache tab. Go in there and click the button to enable the cache. Having done that everything should work fine and your pages will fly.

Incidentally, I just did a php -v and realised I'm still on PHP 4.3, so I guess I should go and change back that ob_end_clean(); function, but it seems to work fine as it is, so maybe I won't bother.

Leave a comment