Subscribe via

WP-Cache, the Untold Way to Set It Up

WP-Cache is a WordPress plugin that improves your WordPress speed by caching a static version of each dynamic page request and deliverying that static version for subsequent requests to that page. This in combination with WordPress internal cache, Apache cache, eAccelerator op code cache, and Varnish proxy cache provides the ultimate setup to combat traffic storms if your article gets dugg. *Note* that there is also a method that helps you turn on WP-Cache on demand (only during traffic storms), but I will discuss that in a later article.

If you’ve ever tried to install the WP-Cache plugin for WordPress just by uploading to the wp-content/plugins directory and activating it via WordPress Plugins administration, then you know that 99% of the time that method will not work because of some file permission problems.

Here is the proper way to do it:

1. Unpack wp-cache into the directory wp-content/plugins

2. Starting at your web root, create a directory called “cache” under wp-content and give write permissions to your apache user group.

cd wp-content 
mkdir cache 
chgrp www cache # my apache user group is "www" 
chmod 775 cache

3. Starting from the web root, also make wp-content writeable by your apache user.

chgrp www wp-content 
chmod 775 wp-content

4. Starting from the web root, create a symbolic link from wp-content/advanced-cache.php to wp-content/plugins/wp-cache/wp-cache-phase1.php

cd wp-content 
ln -s plugins/wp-cache/wp-cache-phase1.php advanced-cache.php

5. Modify your wp-config.php to include the following line of code:

define('WP_CACHE', true);

6. Go to the “Plugins” administration menu and enable the WP-Cache plugin.

7. Go to the “Options” administration menu, select WP-Cache from the sub-menu, and enable it.

Now that you’re done, go view your site. If it’s garbled, you have to turn off gzip compression in the administration options and review your site. Look at the page source and you should see something like the followingat the bottom of the code:

<!-- Dynamic Page Served (once) in 0.963 seconds -->
<!-- Cached page served by WP-Cache -->

This means that it is working! These instructions mirror the included README file but also tells you how to setup permissions properly. I cannot believe how long it took me to figure out how to setup my permissions properly to get this thing to work (remember I’m semi-new to Unix too) so don’t take it for granted! Good luck!

One Response to “WP-Cache, the Untold Way to Set It Up”

[go to last comment]
  1. Recapping: Setting up a FreeBSD 6.2 Web Server | OMNINOGGIN

    […] Optimizing WordPress with WP-Cache […]

[go to first comment]

Leave a Reply