Getting WordPress Super Cache to Run on a Windows (IIS or Apache) Server

If you’re a regular reader, you probably know by now that we just love performance and can’t get enough of server performance-improving software/code… Especially when it comes to WordPress.

Donncha has recently released a great plugin for WordPress, called "WordPress Super Cache." It builds on the original WP-Cache plugin by Ricardo Granada – except that it fixes all the bugs in the original implementation and has been written in enough pure PHP that it’ll also run on Windows servers – both IIS and Apache for that matter! <cue applause>

At the moment (as of version 0.3.1) it needs a bit of work to make it run, but not much. So here goes – 10 easy steps to get cached content on your IIS or Apache server under Windows:

  1. Download Donncha’s plugin here.
  2. Extract it so you have a /wp-content/plugins/wp-super-cache/ directory with all the files (like wp-cache.php) in there.
  3. Copy
    /wp-content/plugins/wp-super-cache/wp-cache-phase1.php to
    /wp-content/advanced-cache.php
  4. Open up /wp-content/plugins/wp-super-cache/wp-cache.php and locate this:
    function wp_cache_check_link() {<br />
        global $wp_cache_link, $wp_cache_file;
  5. Replace that with
    function wp_cache_check_link() {<br />
    	global $wp_cache_link, $wp_cache_file;</p>
    <p>	if ( file_exists($wp_cache_link) )<br />
    	    return true;<br />
    	else {<br />
    	    echo &#8220;<code>advanced-cache.php</code> does not exist<br />&#8220;;<br />
    	    echo &#8220;Create it by copying <code>$wp_cache_file</code> to <code>$wp_cache_link</code> on your server<br />&#8220;;<br />
    	    return false;<br />
    	}
  6. Log into your dashboard and enable WP Super Cache in the Plugins page.
  7. Go to the WP Super Cache options page and enable caching.
  8. Open /wp-content/wp-cache-config.php and look for "WPCACHEHOME" and correct
    a) Add an opening quotation mark before "C:\"
    b) Replace all "\" with "\\" or "/"
  9. Create your rewrite rules like it says in readme.txt. If your using Apache on Windows, use mod_rewrite. If you’re using IIS, you’ll need to use the 3rd party (non-free, but quite good) ISAPI_Rewrite 3.0
  10. If you have mod_gzip, mod_deflate, or IIS dynamic content caching enabled, make sure you don’t enable Super Cache gzip because it’s already being done on the server level (which is better, anyway! :))

Don’t forget to install either our XCache or eAccelerator plugins to speed up the stuff that WordPress Super Cache doesn’t cache, such as logged-in users’ visits and comment processing, etc. as well as visits by people who have commented (see below).

Known Issues

  • WordPress Super Cache doesn’t cache the blog homepage. We’ve contacted the author (Donncha) and expect to get this fixed soon – it is not specific to Windows hosts.
  • The non-Super Cache code (basically, caching for users who have commented) does not work for posts. This is a known bug in the WP-Cache code that WordPress Super Cache is using as a second caching layer, and there is no way around it at the moment. Don’t worry, posts are still being cached, just not for people who post a comment. Make sure you’re using the XCache plugin to avoid this being a bottleneck.

Update:

It seems that if you’re on an Apache server, it’s best to add a directive in httpd.conf stopping mod_gzip or mod_deflate from running in your WordPress directory, and instead using WordPress Super Cache’s built-in GZIP support. This is because Apache will not cache GZIP’d output, so you’ll end wasting thousands of precious CPU cycles re-GZIPping the same content over and over again. IIS users do not have to worry, IIS 6 GZIPs and caches all static content by default.

  • Similar Posts

    Craving more? Here are some posts a vector similarity search turns up as being relevant or similar from our catalog you might also enjoy.
    1. WordPress 2.5 and the Object Cache...
    2. XCache and eAccelerator Plugins for WordPress
    3. XCache and eAccelerator WP Plugins Updated
    4. File-Based Extension to the WordPress Object Cache
    5. eAccelerator PHP Extension Isn't Thread-Safe…
  • 12 thoughts on “Getting WordPress Super Cache to Run on a Windows (IIS or Apache) Server

    1. Thanks, now up and running on my Apache2 WAMP server – much faster now.

      God, PHP (and especially WordPress!) is slow!!!

      I had a hard time getting the rewrite rules working, but now they’re fine 🙂

    2. Could you please clarify step 3 and 4? I am getting a blank page as soon as I enable caching. It’s different than the other typical blank page problems. It seems to be associated to a syntax error in the code. I appears what you say to replace the code with has syntax errors. Your “{” don’t seem correct but I am not an expert. I also assume you mean to replace the complete function with what you specify above…?

    3. I just thought I would provide an update on my blank page problem in my previous post a couple months ago.

      The syntax I questioned before is fine. After multiple attempts to troubleshoot I had to do 2 things different. Than anything stated so far.

      -1 thing I had to do different was my .htaccess file had one small mod from the readme. I had to use “RewriteRule (.+) index.php/$1 [L,QSA]” rather than the similar line (last line) in the readme’s .htaccess

      -The other thing I had to do different than above is in Step 8, it didn’t work with the absolute path. Instead I just have:
      define( ‘WPCACHEHOME’, ABSPATH . “wp-content/plugins/wp-super-cache/” ); //Added by WP-Cache Manager

    4. Glad to hear you got it to work, Scott.

      Switching from WordPress to PerformancePress broke our code-formatting plugins, makes it look like the syntax is all wrong… we never did get around to fixing that.. (/me makes mental note to do it soon!)

    5. Thanks Scott – that all helped to get it working.

      Also, one other thing I discovered is the the line to enable the cache:

      define(‘WP_CACHE’, true);

      needs to be at the top of the config file (wp-config.php) to get wp-cache to generate cached content. Its some weird bug.

    6. Just thought I would pass along that the latest upgrade to 0.6.5 went without a hitch and more importantly, required no customizations. I backed up my plugin dir and did an automatic upgrade. I expected to have to repeat step 4/5 above as this file would have been overwritten but the code must have been improved as my site is running fine without this step above.

    7. I just upgraded to 0.6.5 and it went without a hitch and more importantly, required no customizations. I backed up my plugin dir and did an automatic upgrade. I expected to have to repeat step 4/5 above as this file would have been overwritten but the code must have been improved as my site is running fine without this step above.

    8. I just upgraded to 0.6.5 and it went without a hitch. More importantly, it required no customizations. I backed up my plugin dir and did an automatic upgrade. I expected to have to repeat step 4/5 above as this file would have been overwritten but the code must have been improved as my site is running fine without this step above.

    9. I’ve installed the wp-super-cache plugin in my windows hosting.
      everthing is fine but , plug-in also caches my wp-admin folder.
      When i delete cache and enter the comments page for example, every page becomes the comments page. But i can enter edit-comments.php?comment_status=moderated or admin.php?page=wp-dbmanager/database-manager.php etc. I can’t access pages like post-new.php , plugins.php etc.

      How can i block of caching the wp-admin folder?

    10. As of the current version (0.8.3), here is my experience so far on IIS.

      1. You still have to copy wp-cache-phase1.php to /wp-content/advanced-cache.php
      2. If you change the wp-cache.php file as instructed in steps 4 and 5, the whole thing breaks and will give you a blank page.
      3. Step 8 you need to delete the entire path up to /plugins, so that WPCACHEHOME is set to WP_CONTENT_DIR . “/plugins/wp-super-cache”
      4. It stll doesn’t actually work on IIS anyway, even if the ISAPI_Rewrite module is installed. It complains about not having mod_rewrite.

    11. Sliding Strokes: Essential to this type of massage is the use of sliding strokes. These strokes are executed with care to ensure seamless movement across the skin, maximizing surface area contact and thus enhancing tactile sensations.

    Leave a Reply

    Your email address will not be published. Required fields are marked *