Antiguo y abandonado blog de Ricardo Galli :-(

Wednesday 4/5/2005

WP-Cache 2.0

Filed under: General — gallir @ 16:05

wp-cache-2 plugin

WP-Cache is an extremely efficient WordPress page caching system to make your site much faster and responsive. It works by caching Worpress pages and storing them in a static file for serving future requests directly from the file rather than loading and compiling the whole PHP code and then building the page from the database. WP-Cache allows to serve hundred of times more pages per second, and to reduce the response time from several tenths of seconds to less than a millisecond.

WP-Cache started from the “Staticize Reloaded” by matt and billzeller. Most of their recommendations also apply to WP-Cache. Current version, WP-Cache2, is a huge improvement over previous versions of WP-Cache.

A note about compression

Due to several glitches created by enabling compression (inside PHP via ob_start()) this WordPress feature is not supported by WP_Cache. If you still need compression it’s better to enable transparent compression in php.ini:

zlib.output_compression = On

It works perfectly with WP-Cache.

If you cannot change it or the your server does not allow to enabled it then you don’t need compression at all, or you should look for a better hosting :-)

Introduction

wp-cache-2 plugin file list

WP-Cache is composed of two parts:

  1. Two-phases Wordpress hooks. The first is called at the very begining –wp-cache-phase1.php– when just few code has been compiled. The second –wp-cache-phase2.php– after all plugins have been executed. The first phase checks if the requested URL is already cached, if so it serves from the static file and finishes. The second phase stores the generated page in a static file for future requests.

  2. The WP-Cache plugin. This plugin configures and manages the whole process. It is easy to use and self-documented. It allows you to enable or disable cache, define expiration time for static pages, define rules for rejecting and accepting which URLs and php files can be cached, and shows and delete pages in cache.

Downloading

Version 2.1.2. More info about this versión.

WordPress Plugin Repository (log)

Installation

  1. Upload to your plugins folder, usually wp-content/plugins/ and unzip the file, it will create a wp-content/plugins/wp-cache/ directory.

  2. If you have Gzip Compression enabled turn it off (in Options->Reading).

  3. Activate the plugin on the plugin screen.

  4. Go to “Options” administration menu, select “WP-Cache” from the submenu, the plugin will try to autoconfigure everything. The plugin will try to autoconfigure everything and guide you through the process. In case of failure –normally due to the lack of files’ privilegies– it tell you and give the instructions to solve the problems.

Manual Installation

In case you don’t want to make wp-config.php writeable by the server, or you want to make all steps manually:

  1. Upload to your plugins folder, usually wp-content/plugins/ and unzip the file, it will create a wp-content/plugins/wp-cache/ directory.

  2. If you have Gzip Compression enabled turn it off (in Options->Reading).

  3. Create wp-content/cachedirectory and make sure the web server can write in it.

  4. Make wp-content writeable by the web server.

  5. Create a symbolic link from wp-content/advanced-cache.php to wp-content/plugins/wp-cache/wp-cache-phase1.php.

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

  6. Add the following line to your wp-config.php file:

    define(’WP_CACHE’, true);

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

Frequently Asked Questions

Do I really need to use this plugin?

From “Staticize Reloaded”. Probably not, WordPress is fast enough that caching usually only adds a few milliseconds of performance that isn’t really perceptible by users. Some reasons you may want to use Staticize Reloaded:

  • If your site gets Slashdotted
  • If you’re on a very slow server
  • If you’ve had a complaint from your host about performance

How can I tell if it’s working?

WP-Cache adds some stats to the very end of a page in the HTML, so you can view source to see the time it took to generate a page and rather it was cached or not. Remember that the cache is created on demand, so the first time you load a page it’ll be generated from the database. This first time WP-Cache will add a lines with the total time needed to create the page, if the page is directly served from the cache, it adds a second line telling it was served from cache.

I see gibberish on the screen when I activate this plugin?

Make sure that you deactivated compression on the Miscellaneous options screen and that gzip encoding is turned off on the PHP level.

How do I make certain pages stay dynamic?

You can specify rules that reject request based on URI strings and also specify acceptable files for caching.

How do I make certain parts of the page stay dynamic?

It’s compatible with Staticze Reloaded. From their FAQ:

There are two ways to do this, you can have functions that say dynamic or include entire other files. To have a dynamic function in the cached PHP page use this syntax around the function:

<!--mfunc function_name('parameter', 'another_parameter') -->
<?php function_name('parameter', 'another_parameter') ?>
<!--/mfunc-->`

The HTML comments around the mirrored PHP allow it to be executed in the static page. To include another file try this:

<!--mclude file.php-->
<?php include_once(ABSPATH . 'file.php'); ?>
<!--/mclude-->`

That will include file.php under the ABSPATH directory, which is the same as where your wp-config.php file is located.

I removed WP-Cache and now Wordpress does not work

This occurs because Wordpress still tries to run advanced-cache.php. Remove or comment out the following line to you wp-config.php file:

define('WP_CACHE', true);

Screenshots

This is a chart showing the performance of a WordPress blog under very high loads with and without Staticize. It was taken similarly to this post.

Average load

Average load, logarithmic scale

WP-Cache plugin

WP-Cache plugin, listing files in cache

377 Comments

  1. Continued great work here.. glad to see it moving forward. I might have to back-port it to 1.0 if I’m not moving to 1.5 quickly… ;)

    Two quick suggestions:
    1. it’d be nice if there were an ‘accept-only’ mode, where ONLY those in the ‘always accept these’ box are cached. I use a similar method in my hacked Staticize for CHAITGEAR — I just list the particular files I want it caching, as I know those better than I know what I DON’T want cached (easier to list inclusive rather than exclusive!).
    2. I haven’t poked through the code yet, but I’m hoping you are looking at the executing script filename rather than just the URI? for nice URIs, something like ‘index.php’ wouldn’t show up, yet I might want to never cache my normally-dynamic pages (obviously, this is in line with the first point!).

    -d

    Comment by David — Thursday 5/5/2005 @ 5:25

  2. >1. it’d be nice if there were an ‘accept-only’ mode, where ONLY those in the ‘always accept these’ box are cached.  I use a similar method in my

    Good idea, I will add it.

    Altought you can get the same result by specifying a slash (”/”) in the “rejections” wich will reject every url, and then add “index.php” to “acceptable files”.

    >2. I haven’t poked through the code yet, but I’m hoping you are looking at the executing script filename rather than just the URI? for nice URIs, something like ‘index.php’ wouldn’t show up, yet I might want to never

    For the “accept”, it does so, for rejection, the URI. I think this way gives a finer control (as shown above) .

    Comment by gallir — Thursday 5/5/2005 @ 11:29

  3. Could you check this in the the plugin repository?

    Comment by Matt — Friday 6/5/2005 @ 1:22

  4. Ok, I found the common pattern, I think I solved. It seems to me a very nasty PHP4’s bug.

    Your servers do not have semaphores, so wp-cache fallbacks to flock() and uses a global variable that stores the filename of the lock file. But php4 does not make (that’s the bug) that variable global if it’s declared in a included file.

    I just uploaded beta4 which fixes this, it should work now.
    http://mnm.uib.es/gallir/wp-content/wp-cache-2-0-beta4.zip

    Thanks for testing.

    Cheers.

    PS: I will delete all previous messages so we start clean again :-)

    Comment by gallir — Friday 6/5/2005 @ 21:02

  5. Everything installed ok, but for some reason the ‘Rejected User Agents’ box isn’t showing. I’ve tried reuploading, and also my local install shows the box (using the same files!). I’m not too bothered but if I want to add another agent can I just add `N => ‘botname’` to config sample?

    Comment by Ian — Friday 6/5/2005 @ 21:14

  6. For some reason (it should if it’s >= 4.3, perhaps a missing module?) your server’s PHP version does not have this function, so there is no point in configuring it if it’s no going to work.

    Comment by gallir — Friday 6/5/2005 @ 21:26

  7. I also don’t get the ‘Rejected User Agents’ on a server that runs redhat ES stock php rpm … 4.3.2, but on my local box and another server php 4.3.11 its ok.

    Comment by jaume — Friday 6/5/2005 @ 22:04

  8. Great plugin! I’ve been having some ongoing issues:

    (1) Dynamic Pages

    I’m having an issue with a dynamic email form page I have with Internet Explorer 6. The form submit gets cached, so the php doesn’t run. So I added the name of the file, email-dave.php, to the REJECT list so it won’t be cached. . The full URL is http://davidseah.com/wordpress/email-dave.php.

    It works in Firefox on XP and also in Safari on Mac OS X: the php script executes properly. However, in Internet Explorer 6 on Windows XP, I get a 404 FILE NOT FOUND error from the browser. If I disable the caching entirely, though, it works. Perhaps this is related to the user agent rejection code? The reported version of IE is 6.0.2900.2180.xpsp_sp2_gdr.050301-1519.

    (2) Cookies

    Just a comment, I have more than just wordpress-related cookies on my site. Since these cookies change somewhat more frequently and are not related to wordpress, would it make sense if wp-cache actually only used, say, the wp-user-* cookie as a key, rather than ALL of them on the site?

    Form submission page issues is what has been plaguing me for the past few weeks with wp-cache.

    Comment by Dave — Saturday 7/5/2005 @ 2:05

  9. If I deactivate the plugin from the Plugin page without first deactivating the cache on the wp-cache Options page, that leads to errors. I have to deactive on the Options page before deactivating the plugin.

    Is it possible to also disable the caching when one deactivating the plugin?

    Comment by Dave — Saturday 7/5/2005 @ 2:36

  10. It seems to me that you are not only “deactivating”, but moving/removing the whole wp-cache directory or files. If you do that, you should remove the “define(’WP_CACHE’, true)” from wp-config.php.

    That is failing because Wordpress calls to advanced-cache.php, which is a dangling link or does not exist if you removed it.

    Comment by gallir — Saturday 7/5/2005 @ 2:43

  11. unziped, uploaded, made wp-content 775 - ugh, that was recursive on all templates… does it have to be 775? or even 777 maybe? CHMOD, I mean. Anyway, made wp-config writable 766 CHMOD, plugin activated. NOTHING, no cache directory created, no cache files, nothing when I go to options : wp-cache (except the link).

    any ideas?

    Comment by marlyse — Sunday 8/5/2005 @ 7:33

  12. To #11,
    very strange the WP-Cache plugin is not called/exceuted from the “Options” menu. Could you see the HTML source? Can you send it to me?

    PS: the plugin enables the cacheing process, so it’s normal you don’t get populated the cache yet.

    Comment by gallir — Sunday 8/5/2005 @ 12:48

  13. Hi,
    gret plugin! But I was wondering if ther is a way to includes folders in the name of files that have t obe cached? Or even regular expressions? For example, I have a folder called pictures that resides in wp-content. I could specify every file in pictures, but that would be tedious…

    Thanks!

    Comment by didier — Sunday 8/5/2005 @ 17:50

  14. To #13:
    pictures are already static files and they don’t need to be cached.

    Comment by gallir — Sunday 8/5/2005 @ 19:51

  15. Thanks for your fixes and looking at my site issue, Ricardo. I dumped my crusty WP 1.0 script for email form submit and am using Ryan Duff’s WP-ContactForm. A couple new issues I came across:

    (1) There seems to be a conflict though for the OPTIONS configuration when both WP-Cache and WP-ContactForm are installed. When WP-ContactForm is activated, the WP Cache options no longer display. You can see the WP-Cache tab at the top of the admin->options screen, but clicking on it shows only a “blank” screen: the WP Admin frame shell, basically, with no controls of any kind. When I disable WP-Contact Form, the problem goes away. WP-ContactForm and WP-Cache are the only plugins I have that have the custom WP-Admin Option Config pages.

    http://ryanduff.net/projects/wp-contactform/

    (2) A feature: It would be nice to see some kind of cache utilization statistics, either on the Admin Option screen for the plugin where you set the timeout, or perhaps on the “static page served” comment. I had hacked a simple PHP counter into the earlier version to try to figure out what kind of cache-hit rate I was getting, and used this to tune the cache timeout to a more useful number than the default of 3600 seconds.

    Thanks!

    Dave

    Comment by Dave — Sunday 8/5/2005 @ 22:03

  16. To Dave:

    (1) I took a look to wp-contact-form to see if there was some namescpace conflict, but it seems it wasn’t. Nevertheless I sanitized all wp-cache function names and released 2.0.1. Just in case, but I don’t believe this is a problem.

    (2) The problem is wp-cache should write a file for every access, this plus the necessary concurrency control will generate a lot of overhead.

    Comment by gallir — Sunday 8/5/2005 @ 23:37

  17. After trying 2.01, I saw no change. But I did find a reference to a WordPress 1.5 bug: http://mosquito.wordpress.org/view.php?id=902

    Apparently, if you have more than one options page, only the last one loaded works. The solution was to grab the fixed version of wp-admin/menu-header.php out of their repository. My WP-Cache menu items show again…hooray!

    Regarding the overhead for writing statistical information:

    Yes, I see…that would defeat the purpose to some degree. Though if the overall goal is to optimize system load, it would be useful to have some kind of profiling tool. Perhaps a future version could have a “profiling option” that is turned on ONLY for profiling, but is not intended to be left on all the time. Just a suggestion…if there are better ways to do this with other tools (keeping in mind that I am on a shared server), then any suggested approaches are appreciated.

    Thanks again for your great work,

    Dave

    Comment by Dave — Monday 9/5/2005 @ 4:46

  18. I installed the plugin and works correctly, except that it does display weird characters when on words that have accents. I have noticed than 1st time I load a page is ok, but when requesting it again (cached page) it displays those weird characters. If I deactivate plugin (run from php), words are displayed correctly.

    have someone the same problem or you just don’t use accents ?

    Comment by Toni — Monday 9/5/2005 @ 10:16

  19. I’m using accented characters (this blog :-) ), that occurs because your apache/php does not provide http headers. Please check them with and without wp-cache and paste them here. May be you have one character set in WP and another one in the apache configuration. If so, change it in WP or take it out from Apache. [1]

    It might happens also that there is some PHP warnings and the headers are lost. Please check the html code of those wrong pages to see if there is any error message.

    You can also send me a couple of generated .meta files so I can check which headers are missing.

    [1] BTW, although this problem is due to misconfiguration, I’m thinking wp-cache can grab the content-type directly from WP conf. I’ll try it later today.

    Comment by gallir — Monday 9/5/2005 @ 10:32

  20. My problem resolved…

    wp-content directory needs be writable by the server because when you enable wp-cache in wordpress, create wp-cache-config.php file and need it.

    chown www-data.www-data wp-content

    Comment by davidcg — Tuesday 10/5/2005 @ 2:50

  21. The plug in seems to be working fine, but I get this error at the top of my admin window, and each freshly loaded page:

    Warning: semget() failed for key 0×152b: Permission denied in /wordpress/wp-content/plugins/wp-cache/wp-cache-phase2.php on line 76

    Any idea whats causing this?

    Comment by Steve — Thursday 12/5/2005 @ 14:13

  22. Nice work, Ricardo!

    I think you may have a little bug: While apache_response_headers() returns an associative array with key-value pairs, headers_list() returns an array with numerical keys, and the value contains the whole header

    Array { [’Content-Type’] => ‘text/html; UTF-8′ }

    Array { [0] => ‘Content-Type: text/html; UTF-8′ }

    If I am not mistaken.

    Comment by Sencer — Thursday 12/5/2005 @ 14:38

  23. Wonderful plugin. Caching is new to me so I have a few basic questions that I didn’t see discussed elsewhere.
    1. Does wp_register() and wp_login() template tags need wrapping around them to avoid showing cached versions (register/siteadmin, edit-links etc) to the public or how does it work? I tested this by accessing with two browsers (ff&ie) at the same time, logging in with the other and it seems to serve different cache to the one where I logged in, so everything is miraculously ok by itself without mods?
    2. After a few minutes of fiddling, there are five versions of the frontpage (root) in the cache, is this ok, hopefully all users don’t have their own separate cache? :) I don’t know anything about caching, is this related to different browsers, cookies, or what?
    3. And lastly, I understood that the whole cache expires when a change is made to any page, post, comment etc. This is most useful, but just out of curiosity, are there any exceptions when this would not work? Of course changing templates does not expire the cache, but then I can delete the cache from admin options which is nice.

    Comment by Pete — Thursday 12/5/2005 @ 15:58

  24. …in addition to previous questions, I guess it should be straightforward to generate the random link list dynamically, but why doesn’t the following work? (hopefully the code appears correctly below)
    ‘, ”, ‘ ‘, ‘FALSE’, ‘rand’, ‘FALSE’, ‘FALSE’, ‘50′, ‘FALSE’, ‘TRUE’) ?> –>
    ‘, ”, ‘ ‘, ‘FALSE’, ‘rand’, ‘FALSE’, ‘FALSE’, ‘50′, ‘FALSE’, ‘TRUE’) ?>

    Comment by Pete — Thursday 12/5/2005 @ 16:49

  25. Before messing my site up completely…
    How does this plugin behave if I have multiple themes installed?
    Does it cache different copies of a page for the different themes or will it just cache the default theme?
    (I hope it won’t cache the page with the first theme used to display it…)

    Comment by DElyMyth — Thursday 12/5/2005 @ 16:51

  26. …well, it didn’t show up properly, but it was an example of displaying random selection of links using get_links() wrapped in mfunc-thingies, I guess quite many have that kind of thing on their sites, but I cannot get it refresh on reload with wp-cache..

    Comment by Pete — Thursday 12/5/2005 @ 16:53

  27. To #21: it seems it’s a problem creating semaphores. Very strange, it’s a problem of your php4 installation.

    To #22: You might be right, I will check it tonight (or in following days, I’m leaving to USA in few hours :-) )

    To #23:

    1. If you check the “rejection panel” you will see that any URI with the string “wp-” is not cached.

    2. Any “non anonymous” user get her own cache version due to their own cookies. It’s normal and should be so.

    3. Yes, any change will delete all cached files, except a “moderation” because WP don’t (or didn’t in 1.5.0) have a hook for calling a function after a comment has been aproved in the moderation.

    Comment by gallir — Thursday 12/5/2005 @ 16:55

  28. To #25:

    ¿How do you select a theme? If it uses users’ cookies, it should work. WP-Cache take in account those cookies that identify non-anonymous users.

    If the theme selections are using different cookies (I have no idea), it’s not a problem just tell me their names and I can add them.

    Comment by gallir — Thursday 12/5/2005 @ 16:59

  29. ” it seems it?s a problem creating semaphores. Very strange, it?s a problem of your php4 installation.”

    This is the generic PHP as given to me by my host, powweb.com.
    What can I do to fix it?

    Comment by Steve — Thursday 12/5/2005 @ 21:49

  30. To #29, Steve

    You can try two thing.

    1. First try changing the $sem_id value en wp-cache_config.php.

    2. If the previous does not work, try uncommenting the following line inf the same file:

    $use_flock = true; // Set it tru or false if you know what to use

    The last will force wp-cache to use flock() instead of semaphores.

    Hope this helps.

    Comment by gallir — Thursday 12/5/2005 @ 22:36

  31. Great plugin. But it needs to recache the pages that’s commented or pinged.

    Comment by Kyrre Baker — Friday 13/5/2005 @ 3:51

  32. Al activar el wp-cache, los acentos de mis paginas también se sustituyen por cosas raras. He hablado con mi proveedor de hosting y me dice que su php es una instalación estandar que viene con redhat enterprise. Se puede resolver este problema sin tener que depender de la instalación de php del hosting? …. es extraño, pero si desactivo el wp-cache los acentos aparecen de nuevo.

    Comment by Manu — Friday 13/5/2005 @ 9:31

  33. The cookie for the theme is $_COOKIE[’wptheme’.COOKIEHASH] (taken from my code, it displays the theme name as well as the comment_author name in the top of the pages).
    It comes directly from the theme switcher plugin.
    Anyway, I hope I can try to install it in this weekend, I have some pages with hundreds of comments which are quite heavy, and also a big link-list where I put all the books I plan to read and buy and this is heavy too.
    Not really too heavy, but it can slow the server down if too many users come at the same time I think.

    Thanks for the answer ;-)

    Elena.

    Comment by DElyMyth — Saturday 14/5/2005 @ 8:11

  34. Hola! There seems to be a problem with including dynamic functions - the code simply does not exist. :) When grepping “mfunc” only readme.txt mentions it, am I right?

    Comment by Pete — Sunday 15/5/2005 @ 2:57

  35. Yes, you are right, only “mclude” is checked… I will check it out against stiticize to assure compatibility (it it does implement mfunc…).

    Thanks

    Comment by gallir — Sunday 15/5/2005 @ 4:30

  36. Ricardo, excellent plugin. :-) However one small problem. I have just installed the Subscribe to Comments plugin (http://txfx.net/2005/03/28/wp-subscribe-to-comments-20-alpha-2/) and for some reason their WP Admin panel and yours are clashing (under Options). If you disable WP-Cache you can use their admin, otherwise you cannot.

    Comment by NP — Sunday 15/5/2005 @ 19:53

  37. The next version of WP-Hashcash (2.11) will automatically detect the WP-Cache definition and work nicely with it! Great work, I love this product ;)

    Comment by Elliott Bäck — Monday 16/5/2005 @ 21:05

  38. I’m having a similar problem as #36. When I have the WordPress Email Notification Plugin v2.1.1 ( http://watershedstudio.com/portfolio/software/wp-email-notification.html ) the Options WP Cache admin pannel is just blank. By de-activating the Email notification plugin, I was able to complete the install and activation of WP-Cache. But once I re-activated the Email notification plugin, the WP-Cache options admin panel is now gone. The caching continues to work, I just can’t get to the options menu anymore. The Email plugin also has an Options control pannel, so perhaps they are somehow stepping on each other (Email plugin’s pannel still works like normal).

    Comment by Mike Martin — Tuesday 17/5/2005 @ 1:00

  39. #36 & #37

    I had a similar problem…it apparently is a bug in WordPress 1.5. Upgrading to 1.5.1 will probably fix it, or see what I did (see comment #17)

    Comment by Dave — Tuesday 17/5/2005 @ 6:46

  40. Hi, just to let you know, expire time textfield could use some validation perhaps. I accidentally copypasted 86 400 (with space) and the site went completely blank. Disabling caching from wp-config.php didn’t help, as the plugin got called anyway and as admin-area was blank too no way to press wp-cache’s restore configuration.. Renaming the plugin file helped but when renamed back the plugin was activated automatically, so no help there either. As I’m running on hosted environment couldn’t modify wp-cache-config.php where cache_max_time was stated now wrongly (these webserver made files make me/users crazy sometimes) but luckily I could rename the file, wp-cache wrote a default one, and later I found out I could delete the old renamed config file. So now everything is ok!

    Btw, is 24 hours long expiration time somehow bad? I could make it longer still, I have just a few visitors but I like to optimize the user experience — this is so convenient way to cache for me and those few 1+n visitors too.

    Comment by Pete — Tuesday 17/5/2005 @ 15:50

  41. Dave … Thanks! I followed the patch for the bug you linked to in #17, and now the options menus are both showing correctly. Thanks!

    Comment by Mike Martin — Tuesday 17/5/2005 @ 18:31

  42. To **Pete**.

    Thanks for your bug reports, very useful. Right now I’m in California with no much time for hacking, but in few day I¡m going back to Mallorca. So early next week I’ll release a new version with your suggestions.

    Comment by gallir — Wednesday 18/5/2005 @ 3:49

  43. Ricardo- you said:
    “First try changing the $semid value en wp-cacheconfig.php.
    If the previous does not work, try uncommenting the following line inf the same file:
    $use_flock = true; // Set it tru or false if you know what to use”

    Uncommenting the line worked, thanks, but I’m wondering, is it better to do it the first way, performance wise? I wouldn’t know what to change the sem_id to.

    Comment by Steve — Wednesday 18/5/2005 @ 16:46

  44. ricardo, como andas?

    My host yesterday took down my site… I’ve just installed this plugin and my site seems to be working fine … but i dont see the code in the source… so.. i got no idea if this is really working or not :s

    sorry if this is lame :S

    Comment by mariano — Wednesday 18/5/2005 @ 23:33

  45. Hi. I really want to use your plugin but I’m having a strange problem. When I click on WP-Cache in the options I get this error:

    Fatal error: Cannot redeclare wp_cache_add_pages() (previously declared in c:\phpdev\www\wp-content\plugins\wp-cache\wp-cache.php:74) in c:\phpdev\www\wp-content\plugins\wp-cache\wp-cache.php on line 73

    And of course I can’t do the other method of installing because I’m using a windows PC as a server. Can anyone help?

    Comment by Mayan Obsidian — Friday 20/5/2005 @ 8:27

  46. Hi there,

    i like the idea of caching my site, but I have a strange problem:

    if I activate the wp-cache plugin, I can no longer access the confg menu of my PHOTOPRESS plugin (http://www.mydomain.com/wp-admin/options-general.php?page=photopress.php). The menu entry is still there, but it leads me to the wp-cache menu! What’s going on there?

    (Since I don’t know if this is a bug of the photopress plugin, I will post my message there, too)

    Can anyone help? I need both plugins!

    Comment by Raphael — Friday 20/5/2005 @ 13:59

  47. Gallir, question concerning cookies..
    Firstly, when I check from WP-Cache Manager some cached pages, and browse to them (logged out) it sometimes generates a new page and sometimes serves from cache. Also I have something like 8 versions of index.php cached but I think not all of them are for separate logged in users.. Not sure about this, I have very few visitors in general and many might be now generating pages that are already cached..? Sometimes I see many same feed-urls in cache, but that is highly unlikely to be due to logged in visitors. Of course when I reload the page it comes from cache, but I don’t know how many different visitors certainly get a cached page. Does operating system, browser, position of the moon affect this? :)
    Secondly, I just tried polyglot (language picker) plugin, and is it ok to rename its cookie starting with “wordpress_” or is that a wrong way to make it compatible with wp-cache? I’m browsing through the code trying to understand how this cookie business is handled.. This point might be related to my first question, but I experienced same kind of double/triple-caching also before trying out polyglot.

    Comment by Pete — Monday 23/5/2005 @ 0:00

  48. To #47:

    Every user who has a cookie, including those that only wrote a comment and “saved” username and email, forces wp-cache to generate a specific page (they can see their names in the comment’s form).

    Comment by gallir — Monday 23/5/2005 @ 1:44

  49. I just installed WP-Cache on a WP1.5 blog & though it works fine on the blog, it has problem with the pages that WP creates, I mean that static pages. When I try to visit any page, it downloads onto my PC & it has junk characters in it. I’ve disabled the GZip from the WP Options. However, if I disable WP-Cache, then the page opens quite well.

    I added the page URL in the Rejected URI’s section but still no good.
    the URL is http://digit.igeek.info/. Click on the `About` link on top & it’ll download a file on your PC. The `Contact` link works only because its a seperate file & is not using WP at all.

    Can you help?

    Comment by Amit Gupta — Monday 23/5/2005 @ 13:36

  50. Ah, its working now, how I don’t know!!!!!

    Comment by Amit Gupta — Monday 23/5/2005 @ 13:39

  51. erm, sorry about my last post on getting it working, its actually I had disabled WP-Cache & didn’t notice it & hence the page was working. The issue is still there, can you please help?

    Comment by Amit Gupta — Monday 23/5/2005 @ 13:46

  52. To #49, 50, 51: It works perfectly from here…

    Pewrhaps you are still retrieving the wrong pages generated when gzip was enabled. Just clean your cache files if still you see garbage.

    Comment by gallir — Monday 23/5/2005 @ 13:54

  53. I was still getting it even after clearing my browser cache & re-starting my browser(IE6). So I just deleted WP-cache & re-installed it. Now it looks ok, don’t seem to generate any problems. :)

    BTW, I’ve changed the cache directory to be outside wp-content. so why does it still need write permissions in wp-content directory?

    Comment by Amit Gupta — Monday 23/5/2005 @ 21:17

  54. I get a blank web site… as in completely blank. :/

    Comment by Denis de Bernardy — Monday 23/5/2005 @ 22:24

  55. ### New version 2.0.2

    - Added mfunc sintax as in Staticize Reloaded 2.5,
    also keep tags but take out function calls
    - Check of numbers are really numbers in web forms.
    - Remove header_list function verification, its result are not
    the same.
    - wp-cache now verifies if gzipcompression is enabled

    Comment by gallir — Monday 23/5/2005 @ 22:36

  56. nevermind, problem is solved. Ahem… I cannot create a frikin link on my server. And I am probably not the only one in this case. ;)

    Thus, I got blank page. I fixed by manually creating a copy of the file. And now, the following error:

    advanced-cache.php link does not exist
    (…)
    Cannot continue… fix previous problems and retry.

    Just for you to know. ;)

    Comment by Denis de Bernardy — Monday 23/5/2005 @ 22:37

  57. When I use WP-Cache, my web site statistics are thrown off (specifically in Stattraq). Is there anyway to correct for this?

    Comment by Steve — Monday 23/5/2005 @ 23:52

  58. What do you mean with “statistics”? That’s way to general, perhaps you mean “some/a stats plugin”?

    I don’t know how stattraq works, if it’s executed for every problem, of course it won’t count if pages are cached.

    But… you could use “mfunc” or “mclude” syntax if the plugin is simple, see README.txt (altought don’t expect the same performance).

    Comment by gallir — Tuesday 24/5/2005 @ 1:24

  59. Nice work! Just one suggestion: It might be advisable to limit direct access to the cache directory (Deny from all) so people can’t go browsing cached files.

    Comment by Jürgen Kreileder — Tuesday 24/5/2005 @ 2:48

  60. Disallow directory listing and/or access in Apache, or just put an empty index.html page.

    Comment by gallir — Tuesday 24/5/2005 @ 2:58

  61. I think it would be more appropriate if the plugin would put a .htaccess in the cache directory.

    Comment by Jürgen Kreileder — Tuesday 24/5/2005 @ 3:13

  62. With wp-cache turned on, Stattraq (and I assume any web stats app, such as Webalizer or Awstats) only records hits to newly served pages, not the cached ones. I suppose I would need to hack stattraq to look at the cache directory somehow, but this seems complicated in terms of it knowing what each cached page is.

    You’re right, mfunc and mclude would work to a degree, but to use them would negate the purpose of caching in the first place :)

    Comment by Steve — Tuesday 24/5/2005 @ 5:02

  63. > (and I assume any web stats app, such as Webalizer or Awstats) only records hits to newly served pages

    No, they are unrelated, webalizer o awstats use the logs generated by Apache, which is the same for cached or uncached pages.

    Comment by gallir — Tuesday 24/5/2005 @ 9:59

  64. I have installed 2.0.2 version but I am having issues with weird characters on cached pages … seems I have same problem as #18

    Comment by steve — Tuesday 24/5/2005 @ 10:06

  65. Did you check your charset configuration? Do you have a default charset configured in Apache? Is it the same for Wordpress? Are you using Apache?…

    Comment by gallir — Tuesday 24/5/2005 @ 11:58

  66. in my testing for my own plugin, it seemed to me that apache_response_headers showed every header - except the Content-Type header, even it was explicitly set before. Hence why the Apache or PHP default-header kicks in, which also defines the charset.
    I “solved” it, by letting users define a custom Content-Type header in the configuration of the plugin.

    Interestingly headers_list does show the Content-Type header, but it is a) PHP5 only, 2) it appears to buggy and in certain setups only returns an empty array(). :-/

    Comment by Sencer — Tuesday 24/5/2005 @ 17:43

  67. Default charset in apache,php and wordpress is ISO-8859-1 and it works correctly when I disable wp-cache. Tried to set all to UTF-8 but same results.
    When wp-cache is enabled weird characters appear when files are being read from the caché files.

    Comment by steve — Wednesday 25/5/2005 @ 8:24

  68. Please test a patched version (2.0.2b) to see if it solves your Content-Type/charset problem.

    If so, I’ll make “official”.

    Comment by gallir — Wednesday 25/5/2005 @ 13:31

  69. Funciona !!! … resuelto el problema del charset !!! con la ultima version que pusiste .. lo que el zip pone 2.0.2a en lugar de 2.0.2b

    Gracias !!!

    Comment by jaume — Thursday 26/5/2005 @ 9:24

  70. I found that if the list of user agent strings to reject is empty WP-Cache gives an “empty delimiter” error message at line 56 in phase 2. The workaround is obviously to enter at least one UA string.

    Comment by Graeme Pietersz — Thursday 26/5/2005 @ 11:37

  71. ### New version 2.0.3

    2005-05-27: 2.0.3
    - Check for zero length of user agent and uri strings

    2005-05-24: 2.0.2a
    - As a workaround for buggy apache installations, create
    Content-Type header if is not retrieved from Apache headers.

    Comment by gallir — Friday 27/5/2005 @ 3:11

  72. I’ve installed the latest version on a Windows server and receive the following error when I click the WP-Cache tab on the Options page:

    Fatal error: Cannot redeclare wp_cache_add_pages() (previously declared in C:\Dev\wordpress\wp-content\plugins\wp-cache\wp-cache.php:88) in C:\Dev\wordpress\wp-content\plugins\wp-cache\wp-cache.php on line 87

    Any ideas how to fix this one?

    Comment by Mike — Sunday 29/5/2005 @ 6:04

  73. Hello,
    I love WP-CACHE, it just make my wordpress-based blogs fly!
    I fixed every little quirks but now I am left with one very annoying: using FeedBurner I discovered that very frequently feeds served and cached by WP and WP-CACHE are just empty!
    The only content is:

    So I decide to not force the cachinc of wp-rss* wp-atom* etc by inserting the respective file names in the WP-CACHE options panel but the /feed/ files are STILL cached!

    So to prevent having blank rss feeds I am forced to disable WP-CACHE completely but I don’t want to!

    Would you be so kind to help me in fixing this very annoying issue?

    Thanks very much and my sincere congratulations for this gem.

    (I love Menorca)

    Comment by HYPERGURU — Wednesday 1/6/2005 @ 21:42

  74. Add /feed to the “Rejected URI” panel, must work.

    Comment by gallir — Wednesday 1/6/2005 @ 21:45

  75. Add /feed to the “Rejected URI” panel, must work.
    Comentario por gallir — Miércoles 1/6/2005 @ 21:45

    AH!

    I will try it!

    Comment by HYPERGURU — Thursday 2/6/2005 @ 0:33

  76. I love wp cahce, cuz it helped me a lot, but i discovered a bug.

    i’ve noticed that sometimes when i get to my site, it only occurs when i get referred from ohter site
    i see these warnings before my site loads:

    Warning: Cannot modify header information - headers already sent in /home/domains/babeskickass-com/babeskickass/www_root/wp-content/plugins/wp-cache/wp-cache-phase1.php on line 36

    Warning: Cannot modify header information - headers already sent by (output started at /home/domains/babeskickass-com/babeskickass/www_root/wp-content/plugins/wp-cache/wp-cache-phase1.php:36) in /home/domains/babeskickass-com/babeskickass/www_root/wp-content/plugins/wp-cache/wp-cache-phase1.php on line 36

    Warning: Cannot modify header information - headers already sent by (output started at /home/domains/babeskickass-com/babeskickass/www_root/wp-content/plugins/wp-cache/wp-cache-phase1.php:36) in /home/domains/babeskickass-com/babeskickass/www_root/wp-content/plugins/wp-cache/wp-cache-phase1.php on line 44

    I’ve put “@” before those 2 rows with Header();…

    Can you tell me what’s wrong ith that ?

    Comment by miob — Tuesday 7/6/2005 @ 22:22

  77. It’s very stange because at that point no content should have be sent yet. Are you sure you didn’t add any space or blank line outsider the <? php delimiters?

    Check the wp-cache-phase1.php file again please.

    Comment by gallir — Tuesday 7/6/2005 @ 23:18

  78. Alright, 77 posts and no one has asked. Maybe Im the only one that doesnt get it, but I cant figure out how to keep my search function dynamic.

    This is the code Im trying to keep dynamic. Im calling two php functions in it..so maybe thats where Im getting hung up:

    “”>
    ” />

    Comment by Nick Luckett — Wednesday 8/6/2005 @ 5:03

  79. Whoops, my code didnt show up. Check it out here:

    www.4colorrebellion.com/stati.txt

    Comment by Nick Luckett — Wednesday 8/6/2005 @ 5:04

  80. So, what’s the problem? Move “bloginfo” funciton to a file and use the “mclude” syntax to include it instead of “<?php bloginfo(’url’); ?>”

    Comment by gallir — Wednesday 8/6/2005 @ 9:45

  81. Alright, I made a new php file called blog info. This is what I put in there:

    <?php bloginfo(’url’); ?>

    Then I called the function from inside my sidebar.php file like this:

    <form style="padding: 0px; margin-top: 0px; margin-bottom: 0px;"
    id="searchform" method="get" action="<!–mclude
    blog-info.php–><?php include_once(ABSPATH . ‘blog-info.php’); ?><!–/mclude–>">
    <input type="text" name="s" id="s" size="20"
    onfocus="this.value=”" value="<?php if (!$s) { $s = "
    -Search 4cr-"; } echo $s; ?>" />
    </form>

    Is that the correct way? So far I havent been able to get it to work.

    Comment by Nick Luckett — Wednesday 8/6/2005 @ 21:16

  82. To #81:

    No, it’s wrong, please read above the question “How do I make certain parts of the page stay dynamic?”. Also explained in README.txt

    Comment by gallir — Thursday 9/6/2005 @ 1:56

  83. New version 2.0.4

    2005-06-09: 2.0.4
    - Avoid “fwrite() thrashing” at the begining of a connections storm
    - Send Content-Size header when generated dynamically too
    - Clean stats cache before deleting expired files
    - Optimized phase1, EVEN MORE! :-):
    removed random and extrachecks that were not useful in the context
    move checking for .meta at the begining

    Comment by gallir — Thursday 9/6/2005 @ 1:58

  84. Somewhere along the line keeping dynamic code going broke.

    This plugin:
    http://www.w-a-s-a-b-i.com/archives/2004/05/27/wordpress-random-witty-text-plugin/

    I thought it worked on a prior version. Witty works fine without wp-cache.

    Comment by Robert Accettura — Thursday 9/6/2005 @ 2:42

  85. ok, i installed 2.04 version, but you didn’t figure that error with Header() function on line 36 and 44 in file wp-cache-phase1.php, same warnings…

    Comment by miob — Friday 10/6/2005 @ 1:05

  86. No, I cannot reproduce it, I even cannot understand it. It should not occur at least you did modify any wp-cache file. Did you check it as I asked you?

    Comment by gallir — Friday 10/6/2005 @ 13:47

  87. i have copied newest version over old one. i didn’t modify anything after that, i just added @ before Header() function, now i’m not getting error warnings, what i had to check ?

    Comment by miob — Saturday 11/6/2005 @ 12:32

  88. By prefixing the function with “@” you are just hiding the problem. You are not fixing it.

    That error occurs because some HTML content was already sent to the client. So, check if you add some empty lines outside the PHP enclosing tags in your configuration files, i.e. wp-config.php and wp-content/wp-cache-config.php (see comment #77 too).

    Otherwise, you have some problem with you Apache and/or PHP modules.

    Comment by gallir — Saturday 11/6/2005 @ 12:43

  89. i know i’m just hiding the problem, i checked it and i have on the first row function ensuring counting traffic, this function causing any spaces, cuz after removal this row i had no problem, so i know that this has nothing to do with your script.
    thanx

    Comment by miob — Sunday 12/6/2005 @ 11:45

  90. Hi, could we have some upgrade instructions in the readme or here please? Just to make sure it’s done right. :-) Thanks.

    Comment by NP — Sunday 12/6/2005 @ 11:47

  91. To #90:
    Until now, all upgrades to wp-cache-2 only requires to overwrite the files in the plugins/wp-cache directory with the files in the zip file.

    That’s to say:

    cd wp-content/plugins
    unzip wp-cache-xxx.zip

    Comment by gallir — Sunday 12/6/2005 @ 14:06

  92. i have an issue with that yet, i thought i can take it over and put my tracking script after
    require(’./wp-blog-header.php’); in index.php file, but if i will do this my tracking script doesn’t load.
    i just need to put to my index file this row :
    if ((!EREGI(”babeskickass.com”,$HTTP_REFERER))&&($HTTP_REFERER)) virtual(”./cgi-bin/awgtrade/tradecnt.cgi”);

    where to put this row to get this thing working ?

    Comment by miob — Sunday 12/6/2005 @ 20:04

  93. Put it in a different file and use the mclude syntax, as explained in #58 and #80.

    Comment by gallir — Sunday 12/6/2005 @ 21:28

  94. Has anyone else noticed that pages only seem to be cached per user? Is that the intent?

    E.g. If I check the home page in Firefox and check the source, it is the first time it’s been loaded. I refresh and it servers a cached version. If I then check in IE, it is created dynamically again.

    Otherwise it all appears to be working fine, but then load tests only appear to be one person I guess, so it would perform well under tests.

    Comment by AlastairC — Monday 13/6/2005 @ 19:24

  95. To #94: Yes, it does it on purpose.

    Registered users have different pages (see the data in the comments’ form) and it’s not posible to have them in just one cache fro everyone.

    Comment by gallir — Monday 13/6/2005 @ 20:26

  96. Ah, thanks. I don’t have comments on, or other individual content, is there a way I might have one cache for everyone?

    Comment by AlastairC — Tuesday 14/6/2005 @ 19:06

  97. By returning a null string from wp_cache_get_cookies_values() in wp-cache-phase1.php. But it is dangerous, it could disclosure private information –usernames, email…– to all users.

    Comment by gallir — Tuesday 14/6/2005 @ 19:50

  98. So for example, if I was the first person to look at it, the ‘edit’ link would be visible to everyone else?

    Yea, I can see that would be bad!!

    Comment by AlastairC — Wednesday 15/6/2005 @ 0:28

  99. But also, (sorry for second comment, should have thought of this a moment ago), are all non-registered users getting the same cached version?

    If so, great, that is perfect!

    99% of users get the cached (quick) version, and I get the version with the edit button.

    Comment by AlastairC — Wednesday 15/6/2005 @ 0:33

  100. To #99: yes, all anonymous users (i.e. without any cookie) get the same cache.

    Comment by gallir — Wednesday 15/6/2005 @ 0:37

  101. Excellent plugin. Thanks :)

    Hopefully it will make my blog faster

    Comment by Michele — Wednesday 15/6/2005 @ 2:46

  102. Hi, Regarding - #94 - #100.
    I understand why you want to cache a page per wordpress_{user,pass} cookie to allow customization of the comments page(e.g. using username).

    But I dont know why we are using the comments_author_email cookie to generate the key in wp_cache_get_cookies_values(). This causes WP_Cache to store 2 pages per user - when the user has the cookie set(after posting a comment) and when the user does not have this cookie.

    Seems wasteful to me without adding any customization or security benefit

    Comment by Mayank — Wednesday 15/6/2005 @ 19:44

  103. To #102:

    First: WP-Cache does NOT cache any POST request.

    Second: your example occurs only when a new user posts the first time. Next times the cookie is already set.

    Comment by gallir — Wednesday 15/6/2005 @ 20:04

  104. Further to #13 and your reply. What about dynamically generated images? Are they/can they be cached?

    Comment by Graeme Pietersz — Thursday 16/6/2005 @ 12:56

  105. Do you have a a workaround for the sym link.. most hosts have a maximum rights issue of 755 .. and symbloic links are always 777. … this makes in impossible to sym link the two files….

    thanks

    Comment by ringo — Thursday 16/6/2005 @ 20:51

  106. for some reason mcluding a file.php that includes get_links() results in errors (function get_links() not found) in my setup. I tried requiring wp-blog-header.php in that file.php but it didn’t help.. would like to have a random link list generated dynamically on cached pages. any suggestions?

    also one usability hint: maybe you could insert #anchor in wp-cache manager’s cache content panel, so that “update list” and maybe some other buttons too would link to that anchor. somehow I tend to use that button quite often and you always have to scroll down again.

    Comment by Pete — Friday 17/6/2005 @ 21:57

  107. > for some reason mcluding a file.php that includes get_links() results in errors (function get_links() not found) in my setup. I tried requiring wp-blog-header.php in that file.php but it didn’t help.. would like to have a random link list generated dynamically on cached pages. any suggestions?

    Don’t use wp-functions, you cannot do it when the file is cached because no additional php (and obviously, no database connection) is executed. If you add dynamic code, everything must be defined in those included files. But don’t abuse, you will lose all cache advantages.

    > also one usability hint: maybe you could insert #anchor in wp-cache manager’s cache content panel, so that “update list” and maybe some other buttons too would link to that anchor. somehow I tend to use that button quite often and you always have to scroll down again.

    Nice suggestion. I’ll do it next version (just complain to me if I forget to do it :-) )

    Comment by gallir — Friday 17/6/2005 @ 23:23

  108. Your plugin rocks !!!
    Thanks a lot for it.

    Comment by Roman2K — Sunday 19/6/2005 @ 15:36

  109. Version 2.0.5

    2005-06-19: 2.0.5
    - Added “#anchors” to refresh cache files’ list
    (http://mnm.uib.es/gallir/wp-cache-2/#comment-4116)

    As always, just overwrite previous files with those in the zip file.

    Comment by gallir — Sunday 19/6/2005 @ 22:44

  110. Hi,

    I have started using it. I noticed that the time taken to load the page originally is published at the very end in a comment. However the time to serve cached page is not included. Is there any way to know how much time I am saving for a single request and also cumulatively?

    What I get:
    <!– Dynamic Page Served (once) in 1.972 seconds –>
    <!– Cached page served by WP-Cache –>

    Comment by Angsuman Chakraborty — Monday 20/6/2005 @ 16:54

  111. I took it out because it consumes some cpu cycles to give always zero.

    Comment by gallir — Monday 20/6/2005 @ 17:42

  112. That is great :)

    Thanks for the excellent plugin.

    Comment by Angsuman Chakraborty — Tuesday 21/6/2005 @ 20:29

  113. I was wondering if you could incorporate a way to show the total time saved in x number of days(from start) after using this plugin. It should be optional so when we need raw performance we can just turn it off.

    Thanks again for the excellent work. I tried Staticize, Staticize Reloaded. There were problems with my blog. As far as I can see your plugin is working like charm on my blog so far.

    Comment by Angsuman Chakraborty — Tuesday 21/6/2005 @ 20:34

  114. I’m running an installation of WP internally on Windows XP Pro SP2. I realize caching isn’t necessary for this environment but this is a test bed for a public blog that will run on Linux. I don’t know how to handle creating the symlink on Windows and so am getting an error when trying to access the Options page for this plugin:

    Warning: main(C:\xampp\htdocs\wp/wp-content/advanced-cache.php) [function.main]: failed to open stream: No such file or directory in C:\xampp\htdocs\wp\wp-settings.php on line 36

    Fatal error: main() [function.require]: Failed opening required ‘C:\xampp\htdocs\wp/wp-content/advanced-cache.php’ (include_path=’.;C:\xampp\php\pear\’) in C:\xampp\htdocs\wp\wp-settings.php on line 36

    Can you explain what I can do to correct this problem?

    Thanks!

    Comment by Bill Lazar — Tuesday 21/6/2005 @ 21:22

  115. I have no idea of how Windows works (does anybody konws? :-) ). Anyway, copy wp-cache-phase1.php to wp-content/advance-cache.php, it should solve the problem.

    Comment by gallir — Tuesday 21/6/2005 @ 21:38

  116. Okay, that advice cleared the previous error. However, I still get an error when trying to access the wp-cache Options page:

    Fatal error: Cannot redeclare wp_cache_add_pages() in C:\xampp\htdocs\wp\wp-content\plugins\wp-cache\wp-cache.php on line 99

    Any ideas to clear it? I’m running v2.0.5.

    Thanks.

    Comment by Bill Lazar — Tuesday 21/6/2005 @ 22:12

  117. No idea, that error was reported befoe (see one comment above), It seems to me is a PHP or installatiob bug. It is not reproductable in any of my Apache+PHP GNU/Linux servers.

    Comment by gallir — Tuesday 21/6/2005 @ 22:58

  118. I have noticed one thing that should be changed in wp cache or even as a tool in that.
    i’m getting huge loads on server even wp cache is running, but it happen only when all cached log files are deleted, because each surfer loads mysql, all log files having same similar time of expiration, and it’s about same time when all files are deleted and my server is gone. The best would be to delay each next file, not to put them on one user defined time of expiration, do you understand me ?

    Comment by miob — Wednesday 22/6/2005 @ 0:25

  119. To #118, it was this way a couple of versions before (with a random time plus expire time) but it has almost no effect because what you describe happens more often when all cache is deleted due to editing articles or new comments.

    I’ll think a better idea, perhaps waiting few hundreth of seconds between ever delete operation.

    Comment by gallir — Wednesday 22/6/2005 @ 1:17

  120. then i understand, i noticed huge loads in time when i post new articles as well,
    yeah think out something , i have a lot of traffic and can test it out.
    check out my server loads: http://vodex3.exmasters.com/hotsanic/system/load.html

    Comment by miob — Wednesday 22/6/2005 @ 12:31

  121. I’m working on it. The idea is, when a post or comment is edited/added, to delete only those files that are related, i.e. the post cache and “indexes” pages, but to keep caches of different articles.

    I’m having some difficulties because WP does not keep clearly the article ID after a post, different form’s fields must be checked.

    I hope in few day i’ll be able to release a new version with this feature.

    Comment by gallir — Wednesday 22/6/2005 @ 16:10

  122. yeah that’s the beast idea if you’re able to work it out somehow.
    i’m going on vacation, then will test it out
    thanx

    Comment by miob — Wednesday 22/6/2005 @ 16:52

  123. New version
    2005-06-19: 2.0.6
    - Delect cache _selectively_. If post_id is known
    it deletes only that cache and the general (indexes) ones.
    See: http://mnm.uib.es/gallir/wp-cache-2/#comment-4194
    - Delete cache files (all) also after moderation.

    Comment by gallir — Thursday 23/6/2005 @ 2:54

  124. I was running into the “cannot redeclare” error as others were, but I modified the wp-cache.php and now I don’t get that error anymore. This is what I did.


    function wp_cache_add_pages() {
    //add_options_page('WP-Cache Manager', 'WP-Cache', 5, __FILE__, 'wp_cache_manager');
    add_options_page('WP-Cache Manager','WP-Cache', 5, 'wp-cache/wp-cache.php', 'wp_cache_manager');
    }

    However, when I click on the WP-Cache under Options, it shows the WP-Cache Manager box but there is nothing in it. It appears as if there is a problem in the wp_cache_manager function… I’ll keep poking around…

    Comment by jeff — Thursday 23/6/2005 @ 7:22

  125. I SOLVED THE PROBLEM ON WINDOWS SERVERS…

    I don’t know if this is a good solution or not, but I simply bypassed the function call to wp_cache_check_link() in the wp-cache.php file by adding return true; right at the beginning of that function. I don’t think Windows knows what to do with the symlink commands. I simply copied wp-content/plugins/wp-cache/wp-cache-phase1.php to wp-content/advanced-cache.php and all is working. What’s the deal with needing the symlink/copy anyway?

    Comment by jeff — Thursday 23/6/2005 @ 7:34

  126. > What’s the deal with needing the symlink/copy anyway?

    Wordpress core _ejecute_ the file pointed by that link.

    Wha’s the deal with needing Windows to run PHP/MySQL/Wordpress anyway? :-)

    Comment by gallir — Thursday 23/6/2005 @ 10:01

  127. New version

    2005-06-23: 2.0.7
    - Add an extra control to make sure meta_mtime >= content_mtime
    (it could serves incomplete html because other process is re-generating
    content file and the meta file is the previous one).

    Comment by gallir — Thursday 23/6/2005 @ 16:15

  128. Referers, downtime and caching

    As you may have noticed the site has been down for a few weeks now. While it’s an eternity on the internet it flies by in realtime, especially when you’ve got so many other balls in the air. To make a long story shorter…

    A few weeks ago I notice…

    Trackback by Ben's Blog — Saturday 25/6/2005 @ 5:07

  129. Gallir, nice plugin. I just switched from Staticize Reloaded to WP-Cache. I am experiencing some problems however. When loading cached versions of a page, I get all these Fatal error: Call to undefined function: some_plugin_function() in /var/www/html/wp-content/cache/wp-cache-c573e5fc863c4ccc30f8c340501f124c.html on line 148 type of things, in which some_plugin_function() is of course a function from an active plugin. WTF? Is this a wp-cache-phase1.php vs. wp-cache-phase2.php issue? Any ideas?

    Comment by Mathias Bynens — Monday 27/6/2005 @ 9:48

  130. You cannot call any plugin’s function from WP-Cache. They are not execute. If you want to do complex things, “mclude” a file with all the necessary functions.

    Comment by gallir — Monday 27/6/2005 @ 15:36

  131. Will this ever be implemented in WP-Cache? Stuff like this works in Staticize Reloaded… Why not include the plugin files and the my-hacks.php file before sending the cached output? :(

    Comment by Mathias Bynens — Monday 27/6/2005 @ 18:18

  132. No.

    Obviously because you will lose the main wp-cache advantage (and leiv motif): speed, throughput and responsiveness similar to those of static files.

    If you want to do it, include it from you “mcluded” file, no problem. But don’t expect the same speed.

    Comment by gallir — Monday 27/6/2005 @ 18:27

  133. At a time, wp-cache deleted the entire cache when i edited a page. this no longer works. how come?

    Comment by Denis de Bernardy — Thursday 30/6/2005 @ 12:32

  134. That’s normal and it shows that wp-cache works. Look at #123 (http://mnm.uib.es/gallir/wp-cache-2/#comment-4209). It only deletes the article’s cache and all “indexes” pages, those that can change when a post is edited/added.

    Comment by gallir — Thursday 30/6/2005 @ 13:38

  135. Aye, except that wp-cache no longer works with two of my favorite plugins:

    http://www.semiologic.com/projects/sidebar-tile/
    http://www.semiologic.com/projects/smart-link/

    Comment by Denis de Bernardy — Thursday 30/6/2005 @ 21:22

  136. might the fix involve something like doing:

    uncomment in function `wp_cache_post_change($id)`:

    //wp_cache_phase2_clean_cache($file_prefix, get_query_var(’p'));

    comment everything thereafter until:

    wp_cache_writers_exit();
    return $id;

    ?
    ?

    Comment by Denis de Bernardy — Thursday 30/6/2005 @ 21:26

  137. actually, `wp_cache_writers_exit();` gets commented as well.

    Comment by Denis de Bernardy — Thursday 30/6/2005 @ 21:30

  138. I does make sense at least the plugins do something weird (and wrong) with global variables tha identifies posts’ ID.

    Comment by gallir — Thursday 30/6/2005 @ 21:56

  139. Denis, performing a simple do_action('edit_comment'); will clear all cache files. Hope this helps you.

    Comment by Mathias Bynens — Saturday 2/7/2005 @ 16:36

  140. Hello,
    I started with Wp-cache 1.5 it was fantastic.
    yesterday I updated to 2.0.7 it’s even better !
    Congratulations for this dam useful work

    Comment by Luc — Tuesday 5/7/2005 @ 12:04

  141. MayDay !

    I suddently had a problem (without changing anything)
    The relase 2.0 worked like a charm until this afternoon where i got the following error
    Warning: main(/foo/bar/www/blog/wp-content/advanced-cache.php): failed to open stream: No such file or directory in /foo/bar/www/blog/wp-settings.php on line 36

    Fatal error: main(): Failed opening required ‘/foo/bar/www/blog/wp-content/advanced-cache.php’ (include_path=’.:/usr/local/lib/php’) in /foo/bar/www/blog/wp-settings.php on line 36

    The alias do exist.
    I tried to unset the cache, deactivate the plug in and delete wp-cache-config.php then reactivate the whole.. same result.

    I tried to delete the alias to advanced-cache.php but I have a “permission refused” from the ftp server.

    I now run without cache and will be in a real difficult situation (I have a high load weblog).
    I can’t roll back to the version 1.5 ythat I used for months without any problem because the alais problem..

    Any idea ?

    Comment by Luc — Tuesday 5/7/2005 @ 18:51

  142. > I tried to delete the alias to advanced-cache.php but I have a “permission refused” from the ftp server.

    it seems to me that you have some permission problems in the php files. Check the web server can read the plugin scripts.

    Comment by gallir — Tuesday 5/7/2005 @ 23:52

  143. Hey it’s me again, i thing it’s much better now if it doesn’t delete whole cache after any edit but i’d appreciate one switch in cache admin, turn of and on deleting cache, let’s say i’m adding about 5 hours new posts, and every time it’s overloaded due to high load on server, i’m adding new articles into future, and it has no effect on the current status of site, but it every time delete all files, that would help me a lot, check out my server loads http://vodex3.exmasters.com/hotsanic/system/load.html
    will appreciate it very much, cuz i’m ill of it.

    miob

    Comment by miob — Wednesday 6/7/2005 @ 23:53

  144. Version 2.0.7 only deletes files related to the edited posts, the post itself, index and category files.

    Do you mean that posts for the futures force deletion of those files and this generates high load? Strange, because few pages have to be re-generated.

    Is this really the case?

    Comment by gallir — Thursday 7/7/2005 @ 3:02

  145. probably yes, i have no problem when posting into draft, even i think future posts are okay, but when i edit time of post it’s gonna crash. but i have to check whether it delete all files or only related posts.

    other then that it’s fine.

    Comment by miob — Thursday 7/7/2005 @ 13:53

  146. right now, i’m posting only future posts, and sometimes it doesn’t delete nothing, sometimes i see deleted all files and that’s the issue cuz it get hi loads on server.

    Comment by miob — Thursday 7/7/2005 @ 18:00

  147. It’s nice that 2.0.7 fixes the race condition that leads to incomplete HTML being generated–I saw that happen a few times on my frontpage, which I must say, did not make me happy. You may also want to think about adding a check to make sure that the cached file is at minimum n characters..

    Comment by Elliott Back — Saturday 9/7/2005 @ 7:16

  148. Checking for a minimun size (> 0 is already checked) gives no extra security. Furthermore, some most of the “white html” pages did have html headers and styles.

    Comment by gallir — Saturday 9/7/2005 @ 13:20

  149. Ricardo, you are absolutely correct if:

    You assume that WP-Cache will always work flawelessly

    Having a min-size check would have ameliorated the issue in 2.0.6, which would of course still need to be fixed. It’s just a check against accidental errors…

    Comment by Elliott Bäck — Sunday 10/7/2005 @ 7:16

  150. If wp-cache still have any race condition, I have to solve it, but you are no clear, did you find any problem in last version? Are you sure is wp-cache?

    Checking for minimun size is not the solution, doing the right concurrency control is the right one. Indeed, what’s the minimun size? 10? 100? 1000?

    Comment by gallir — Sunday 10/7/2005 @ 10:58

  151. Wonderful plugin! However one big problem.
    I too have faced the blank page issue and it is very bad for my site’s reputation :(

    Checking the minimum size of the file is not the right solution, I agree.
    How about including a comment in the footer and checking for the existence of that comment?
    That will cleanly ensure that incomplete files are not cached.
    You may think that fixing the defects will ensure that incomplete files are not generated, however you can never be 100% sure. The above will ensure only proper pages are cached.

    What do you think?

    Comment by Angsuman Chakraborty — Monday 11/7/2005 @ 14:47

  152. Thios blank page occurs with version 2.0.7? If so I think it’s not a problem of wp-cache but a wp, php or mysql one.

    And yes, I thought to add a check for at least “” before storing any page, so we can avoid these problems. I have to check that

    It would very nice if someone having this problem checks for the cached file (by means of the wp-cache administration’s page) and send to the content to me. I’m not able to reproduce it.

    If there is no one rejecting the idea, version 2.0.8 will check that AND are present before storing in cache. Although they cannot avoid all problems at least we can detect aborted scripts or falied mysql connections.

    Comment by gallir — Monday 11/7/2005 @ 14:55

  153. New version: 2.0.8

    - Add paranoic control to make sure it only caches files with closing “body” and “html” tags.

    Comment by gallir — Tuesday 12/7/2005 @ 3:08

  154. Getting WP-Cache to Work

    WP-Cache is a caching / load balancing plugin for wordpress that takes dynamic pages and staticizes them. It’s based of Matt’s Staticize and Staticize Reloaded series of plugins, and allows you to include dynamic content in the cached tem…

    Trackback by Elliott Back — Tuesday 12/7/2005 @ 10:46

  155. Just installed v2.0.8 and it works great. Thanks!

    Comment by insanum — Tuesday 12/7/2005 @ 22:06

  156. Does it still read version 2.0.4 in the Mange Plugin page? I went through the manual install for 2.0.8, but nothing seems to have changed.

    Thanks for the great work!

    Comment by Faisal — Wednesday 13/7/2005 @ 1:57

  157. Nice caching plugin, should save me considerable grief from my hosting provider.

    One thing that didn’t work according to my expectations was the entire cache was getting cleared when a comment was approved from the moderation page. As I prefer more aggressive caching, especially since I tend to get 20-30 comments a day, I came up with a workaround.

    I created a new version of the wp_cache_post_change() function called wp_cache_post_change_scs() (scs for wp_set_comment_status) that’s used as the filter for the wp_set_comment_status() function. It uses the comment ID passed in and fetches commentdata to grab the post ID. Anyhow, if anyone’s interested it’s available here for as long as the pastebin stores it.

    Comment by ColdForged — Friday 15/7/2005 @ 15:38

  158. It seems to me that you are running an old version, because last version already does what you want. If it does not work might be a WP bug (or a least an inconsistency).

    See function wp_cache_post_id().

    Comment by gallir — Saturday 16/7/2005 @ 23:52

  159. I’m running 2.0.8. I notice your blog doesn’t appear to have moderation turned on. Try editing a comment, setting the status to be “moderated”, saving it, then editing it again and set it to be approved. Then check the status of your cache.

    I saw wp_cache_post_id(). It relies on one of the globals, either $post_ID or $comment_post_ID. Neither of those are set in the moderation case.

    Comment by ColdForged — Sunday 17/7/2005 @ 0:01

  160. > I’m running 2.0.8. I notice your blog doesn’t appear to have moderation
    > turned on. Try editing a comment, setting the status to be “moderated”,
    > saving it, then editing it again and set it to be approved. Then check
    ^^^^^^^
    Sure?

    > the status of your cache.
    >
    > I saw wp_cache_post_id(). It relies on one of the globals, either
    > $post_ID or $comment_post_ID. Neither of those are set in the
    > moderation case.

    But you are using it:

    $post_id = $comment[’comment_post_ID’];

    and WP does not define when you do it from the “queue” although it does for other cases, if you do it from “edit comment” it works (I’m testing it in my development server, which is not the public one).

    I must find a better and general way to solve this specific case without duplicating code and functions.

    Any better idea?

    Comment by gallir — Sunday 17/7/2005 @ 0:52

  161. >Sure?

    Positive. Once you save the comment as “approved” (in other words, the second time) the cache is completely cleared. I wouldn’t have looked for a workaround or the reason if it had worked as expected.

    >But you are using it:
    >
    >$post_id = $comment[’comment_post_ID’];

    I’m using what, $comment? I defined comment locally as “$comment = get_commentdata($id, 1, true);” where it’s a row from the database. That’s very different.

    >I must find a better and general way to solve this specific case without
    >duplicating code and functions.
    >
    >Any better idea?

    Were I to refactor it, I’d likely pull everything that deals with getting the post ID out of that function. Here’s a pastebin for the complete file.

    Comment by ColdForged — Sunday 17/7/2005 @ 3:35

  162. New version: 2.0.9

    - Better control of post_id and comment_id by refactoring the code
    (inspired by a Brian Dupuis patch).
    - Avoid cleaning cache twice due to WP bugs that wrongly calls two actions.

    Comment by gallir — Tuesday 19/7/2005 @ 3:08

  163. New version: 2.0.10

    - Check also for feeds’ closing tags
    (patch from Daniel Westermann-Clark )

    Comment by gallir — Tuesday 19/7/2005 @ 19:53

  164. Nice! That’s an excellent bit of refactoring. Very smart to break the filters out into different calls based on what is received. Bravo!

    Comment by ColdForged — Tuesday 19/7/2005 @ 21:16

  165. Ricardo,
    I’ve raised a ticket on trac to allow non-local dynamic includes. i.e. to allow an include from a different server.
    see http://dev.wp-plugins.org/ticket/226

    Comment by Mike Little — Thursday 21/7/2005 @ 11:14

  166. New version 2.0.11
    - Check also for Last-Modified headers. Last WP version (1.5.3) does not
    it.

    - Move the previous check to the ob_callback, so the aditional headers
    can be sent also when cache still does not exist.

    Comment by gallir — Thursday 21/7/2005 @ 12:59

  167. New version 2.0.12

    2005-07-26: 2.0.12
    - Patch from James (http://shreddies.org/) to delete individual cache files

    Comment by gallir — Tuesday 26/7/2005 @ 23:49

  168. It seems with caching turned on, all pages are returned as text/html. This is not very useful for the RSS/Atom feeds, which are invalid with that MIME type. I spent many hours messing with the web server configuration and mod_rewrite, thinking it was the rewrite config that was broken…

    This is rather sad because I think the syndication feeds are probably going to be the most accessed pages of my site.

    Comment by Nicholas Riley — Saturday 30/7/2005 @ 10:48

  169. No, wp-cache returns the same header that apache/WP do. You have some problem with Apache or PHP4 keeping apache headers (I know also last WP version does no send all the right headers, don’t know why).

    Comment by gallir — Saturday 30/7/2005 @ 10:53

  170. I have found one reference to an Apache/mod_rewrite bug (http://lists.debian.org/debian-apache/2003/04/msg00019.html). But when I disable WP-Cache (on these pages in particular, I can leave it running for everything else), the correct headers are sent.

    So, regardless of whether it is actually WP-Cache’s fault, turning it off makes the problem go away. Oh well…

    Comment by Nicholas Riley — Saturday 30/7/2005 @ 11:00

  171. What’s failing in your case is the function apache_response_headers() that does not return them. Apache or PHP4 bug.

    Comment by gallir — Saturday 30/7/2005 @ 11:08

  172. I just wanted to let you know that WP-Cache performed admirably under a barrage of slashdot users today. Thank you!

    Comment by IO ERROR — Sunday 31/7/2005 @ 1:19

  173. I’m having a problem with sem_get. On every page, I’m greeted with this error:

    Warning: Wrong parameter count for sem_get() in /var/www/cvillenews.com/wp-content/plugins/wp-cache/wp-cache-phase2.php on line 81

    Line 81 is just fine. It reads:

    $mutex = sem_get($sem_id, 1, 0644 | IPC_CREAT, 1);

    I see nothing here that ought to be generating this error. I’ve tried prefixing sem_get with @ to suppress the error, but then no pages will load.

    Several of my websites have become very popular, and my server is crumbling under the load. Any guidance that you could provide would be wonderful.

    Comment by Waldo Jaquith — Saturday 27/8/2005 @ 3:00

  174. I don’t know which server do you use and what modules it loads. Try what I explained in comment #29.

    Comment by gallir — Saturday 27/8/2005 @ 4:34

  175. I changed $use_flock to ‘false,’ as you advised. It fixed the problem with semaphores, thankfully, but now WP-Cache doesn’t do anything at all.

    The footer of the source of each page bears no indication of being statically generated, though WP-Cache is appending the time it took to generate each page dynamically. The second time that any page is loaded, it comes up blank — an empty file is being sent to the browser. WP-Cache is writing cache files (which I’ve verified by viewing the contents of cache directory), but apparently not reading them. The wp-content and cache folders are both readable by the web server (verified by loading the cache files directly in my browser).

    I’m running a stock PHP RPM on a Red Hat 9 server. It’s PHP 4.2.2, compiled with TTF, GDB, GetText, ncurses, GMP, iconv, PNG, OpenSSL, pspell, XML, zlib, BCMath, exif, FTP, SysVSem, SysVSHM, PEAR, IMAP, IMAP-SSL, Kerberos, LDAP, MySQL, PostgreSQL, SNMP, ODBC, BCMath, Calendar, DBX, Dio, Mcal, and APXS2.

    I have been a PHP/MySQL developer since 1999. I’m happy to do any sort of debugging that you’d like me to do on this problem, should it be useful to you or others.

    Comment by Waldo Jaquith — Saturday 27/8/2005 @ 6:09

  176. I can imagine where is the problem (your PHP is old). Look (and post) at the the content of the *.meta files and the files’ creation time.

    Comment by gallir — Saturday 27/8/2005 @ 13:02

  177. I can imagine where is the problem (your PHP is old).

    While it’s not the latest 4.X version, I’m not aware of any changes in PHP between 4.2.2 and 4.3.11 that should lead to

    Look (and post) at the the content of the *.meta files and the files? creation time.

    I just enabled WP-Cache, loaded a couple of files, and disabled it again, in which time two cache files were created, all with the same creation time of 10:32pm EST. The contents of the two *.meta files are:

    O:9:”cachemeta”:4:{s:7:”dynamic”;b:1;s:7:”headers”;a:0:{}s:3:”uri”;s:1:”/”;s:4:”post”;i:0;}

    and:

    O:9:”cachemeta”:4:{s:7:”dynamic”;b:1;s:7:”headers”;a:0:{}s:3:”uri”;s:43:”/2005/08/27/fire-at-badger-fire-protection/”;s:4:”post”;s:4:”1305″;}

    Comment by Waldo Jaquith — Sunday 28/8/2005 @ 4:45

  178. > While it’s not the latest 4.X version, I’m not aware of any changes in PHP between 4.2.2 and 4.3.11 that should lead to

    apache_response_headers

    Besides the lack of headers information, it seems to be OK. If it does not return any data, check if removing @ of “@file_get_contents($meta_pathname)” and “if(!@readfile ($cache_file))” in wp-cache-phase2.php shows more info.

    One of those two functions is not working in your PHP. I recommend you to upgrade PHP.

    Comment by gallir — Sunday 28/8/2005 @ 12:09

  179. You nailed it, Domingo. I completely forgot that file_get_contents() was a 4.3 addition. The exclusion of that command perfectly explains why the second pageview would come up blank. I’ll just write a workaround for this version until I can upgrade PHP. (I’m caught in Dependency Hell right now. :)

    Thanks for your help — I appreciate it.

    Comment by Waldo Jaquith — Sunday 28/8/2005 @ 19:13

  180. Problems in comments #18 #32 #64 are back. I was running wp-cache 2.0.7 and decided to upgrade to lastest version ( 2.0.12 ) and weird characters appeared again. You fixed it on version 2.0.2b … any chance to fix this Content-Type/charset problem?

    Thanks

    Comment by Toni — Monday 29/8/2005 @ 8:36

  181. It is fixed, you have some other problem. Please post one .meta file.

    Comment by gallir — Monday 29/8/2005 @ 12:07

  182. Here one meta file:
    O:9:”cachemeta”:4:{s:7:”dynamic”;b:0;s:7:”headers”;a:0:{}s:3:”uri”;s:76:”/noticias/accion/programa-de-actividades/”;s:4:”post”;s:3:”186″;}

    Comment by Toni — Tuesday 30/8/2005 @ 8:22

  183. Toni, it seems you have the same problems as #177 (your headers are not being retrieved from apache, old PHP?). Look at his real problem in #179.

    Comment by gallir — Tuesday 30/8/2005 @ 10:35

  184. You are right … but my host does not upgrade php ..they just patch it ( I think they use RHE rpm’s ). What I don’t understand is why the old wp-cache version I was using worked ( wp-cache 2.0.7 ) without these issues with the same php version.

    Comment by Toni — Tuesday 30/8/2005 @ 11:00

  185. Perhaps the problem might reside on a PHP upgrade or some change in the configuration. To be sure, can you test the old working version again? Can you post a .meta file of the working version?

    Comment by gallir — Tuesday 30/8/2005 @ 11:19

  186. El efecto Barrapunto

    Probablemente una de las cosas que más temen los administradores de un sitio web, especialmente si es automantenido, es el llamado efecto Barrapunto (o Slashdot Effect). Básicamente consiste en una saturación total del sitio web debido a una avalan…

    Trackback by El Laboratorio del Dr. Yuri — Wednesday 31/8/2005 @ 0:05

  187. to #185 … I put back wp-cache 2.0.7 and it works. See here the meta file … content-type header is there:
    O:9:”cachemeta”:4:{s:7:”dynamic”;b:0;s:7:”headers”;a:1:{i:0;s:41:”Content-Type: text/html; charset=”UTF-8″
    “;}s:3:”uri”;s:10:”/noticias/”;s:4:”post”;i:0;}

    Comment by Toni — Wednesday 31/8/2005 @ 8:24

  188. Please try 2.0.12a, perhaps a plugin or configuration is messing the output buffer http://mnm.uib.es/gallir/wp-content/wp-cache-2-0-12a.zip

    If this does work, certainly the above is the problem.

    Comment by gallir — Friday 2/9/2005 @ 18:42

  189. I have installed 2.0.12a and using the file wp-cache-phase2-new.php it works correctly. Many thanks Ricardo!!!. With wp-cache-phase2.php I get same weirs characters.

    Comment by Toni — Tuesday 6/9/2005 @ 8:43

  190. ¿Ricardo: alguna idea de por qué al activar el wp-cache el WordPress Mobile Edition deja de funcionar? Tengo la versión 2.0.12. Mil gracias.

    Comment by Eduardo Arcos — Tuesday 6/9/2005 @ 23:08

  191. ¿Qué error te da? No has probado por las dudas el 12a indicado en el #188? (así puedo confirmar que funciona o no mejor para todos).

    Comment by gallir — Tuesday 6/9/2005 @ 23:36

  192. Voy a instalarlo y te aviso, mil gracias :-)

    Comment by Eduardo Arcos — Tuesday 6/9/2005 @ 23:45

  193. Ricardo, la 12a tampoco corrige el problema. Cuando instalas el WordPress Mobile Edition hace una redirección a una página light para dispositivos móviles en el momento en que entras al blog. Por ejemplo si entras con el PSP, o con un celular.

    Cuando desactivo el cache la redirección funciona sin problemas, pero si lo activo esta deja de funcionar. Me aseguré de no tener una sola página cacheada antes de iniciar las pruebas.

    Gracias!

    Comment by Eduardo Arcos — Wednesday 7/9/2005 @ 11:52

  194. Ya lo miraré (tendré que mirar que hace el plugin), me ayudarías si me puedes adjuntar las cabeceras que envía hacia el dispositivo. ¿Sabes como hacerlo con el wget por ejemplo? (indicando el “user agent”).

    Comment by gallir — Wednesday 7/9/2005 @ 16:36

  195. 2.0.13 released.

    Changelog:

    2005-09-08: 2.0.13
    - Move request for Apache response headers to the shutdown callback
    It seems some plugins do dirty things with headers… or php config?

    Comment by gallir — Friday 9/9/2005 @ 0:26

  196. When I attempt to use the mfunc syntax on one of my sites I get an error on the page explaining that the function does not exist. The function is in a custom plugin that I’m using. Any ideas?

    Comment by Nick — Saturday 10/9/2005 @ 18:40

  197. You cannot call any WP or WP’s plugin function because they are not available when serving directly from cache: those PHP files were not read at all.

    Comment by gallir — Saturday 10/9/2005 @ 19:20

  198. So then what is the purpose of mfunc if you can’t call any functions? Is there a way it can be done?

    Comment by Nick — Saturday 10/9/2005 @ 19:34

  199. To call php functions and/or include your own functions and php files.

    What you cannot assume is that all wp functions are avaiable.

    Comment by gallir — Saturday 10/9/2005 @ 19:50

  200. And there isn’t a way to be able to do it?

    I love the plugin by the way and have been using it for quite some time. I guess I just misunderstood that part of it.

    Comment by Nick — Saturday 10/9/2005 @ 19:59

  201. You can call whatever function you want if you include the corresponding php files in your file. You must use “mclude” syntax.

    Remember that the goal of wp-cache is efficiency, including (and hence compling and executing) php files takes a considerable time. For this reason WP is relatively slow and does not scale to more than a few concurrent requests. Wp-cache advantage is that avoids all those expensive steps.

    Comment by gallir — Sunday 11/9/2005 @ 2:02

  202. New release 2.0.14

    - Add array() to headers to avoid PHP warnings

    Comment by gallir — Monday 12/9/2005 @ 2:51

  203. Hola!
    Luego de activar el plugin, e ir a Options/WP-Cache me sale el error:
    Fatal error: Cannot redeclare wp_cache_add_pages() in D:\where\ever\your\dammn\server\is\htdocs\wp-content\plugins\wp-cache\wp-cache.php on line 36

    (he borrado el changelog)

    function wp_cache_add_pages() {
    add_options_page(’WP-Cache Manager’, ‘WP-Cache’, 5, __FILE__, ‘wp_cache_manager’);
    }

    La verdad es que no se qué puede ser. Tienes alguna idea?

    Un saludo
    Alejandro

    Comment by Alejandro — Saturday 1/10/2005 @ 21:15

  204. Estás usando Windows por lo que veo, yo no lo soporto para nada. Pero mira el #124 y #125.

    Comment by gallir — Saturday 1/10/2005 @ 21:41

  205. I still get the problem with weird characters (namely, UTF-8 encoded characters considered as ISO-Latin1 or Windows Latin 1) with version 2.0.14.
    First, it happens on IE6 (windows) and Safari (Mac), Firefox seems to be OK on both systems.
    Second, I force the server to display UTF-8 instead of ISO 8859-1 by adding a line in a .htaccess file: AddDefaultCharset UTF-8 (there are other ways to do it, I tried with the smae results). But, I still get the problem.
    Third, I notice that it only happens for the Front Page and for Pages, not for Articles. Articles are OK, Front Page and Pages get this problem.
    Really strange. Do you have a clue?

    Comment by Ralph — Saturday 15/10/2005 @ 23:40

  206. Please, see #187 and show me the same file. It seems to me that wp and apache are configured to different charsets.

    Comment by gallir — Sunday 16/10/2005 @ 1:35

  207. All .meta files are OK. I checked, everything is in UTF-8:
    O:9:”cachemeta”:4:{s:7:”dynamic”;b:0;s:7:”headers”;a:1:{i:0;s:41:”Content-Type: text/html; charset=”UTF-8″
    “;}s:3:”uri”;s:49:”/davidovits/11/the-scientist-and-the-sacred-texts”;s:4:”post”;s:2:”11″;}

    After deleting wp-cache, installing it again, putting the “AddDefaultCharset UTF-8″ line in a .htaccess file, it seems to be better wiht Safari (Mac) and Firefox. However, I still have the problem with weird characters with IE6. It only happens with the front page and with Pages, not with articles. I have IE6 on WinMe. Is it better with XP?

    Comment by Ralph — Sunday 16/10/2005 @ 3:40

  208. According to the files in the .meta file, your Wordpress is configured to work with UTF-8 (the default). According to your previous comment, your apache was previously sending the ISO8859-1, which could confuse to the browser. That’s to say that the text in the database might be stored with the wrong charset.

    But it’s strange the only occurs with “index pages” and not with individual articles. Probably WP is not sending any charset encoding in those cases. You should check all .meta files to see the difference and/or the headers that are sent to the browser (It’s not a good idea to “force” the charset in Apache, I saw others have the same problem, which apache are you using? Which platform?).

    Regarding XP and/or Safari, I don’t use Windows, nor Mac OSX (I use only free software :-)).

    Comment by gallir — Sunday 16/10/2005 @ 4:50

  209. My provider uses an Apache 1.3.33 on Linux, and serves by default at ISO 8859-1. So, I don’t master anything on the server side.
    In fact I asked my brother to test on XP with Mozilla 1.7 and IE6 without touching to any settings. On both, the characters are not interpreted as UTF-8. So, it is worth than I thought. Without wp-cache, it is fine.
    Here is a meta of a page:
    O:9:”cachemeta”:4:{s:7:”dynamic”;b:0;s:7:”headers”;a:1:{i:0;s:41:”Content-Type: text/html; charset=”UTF-8″
    “;}s:3:”uri”;s:22:”/davidovits/biography/”;s:4:”post”;s:1:”3″;}

    Here is a meta of an article:
    O:9:”cachemeta”:4:{s:7:”dynamic”;b:0;s:7:”headers”;a:1:{i:0;s:41:”Content-Type: text/html; charset=”UTF-8″
    “;}s:3:”uri”;s:39:”/davidovits/6/milestones-in-geopolymers”;s:4:”post”;s:1:”6″;}

    Access to the PHP config of my provider: http://60gp.ovh.net/test.php

    The page: www.davidovits.info

    Hope this help…

    Comment by Ralph — Sunday 16/10/2005 @ 12:20

  210. I found the problem in your web. Please check the “meta” tag in the generated html. You will find in your pages:

    http-equiv=”Content-Type” content=”text/html; charset=UTF-8″

    But this is wrong, and confuses badly to some browsers. It should be:

    http-equiv=”Content-Type” content=”text/html; charset=UTF-8″

    I don’t know if you modified WP code, static templates or it’s a WP bug.

    Comment by gallir — Sunday 16/10/2005 @ 13:15

  211. New realease 2.0.15

    - Changed “Content-Size” to “Content-Length”. Obvious bug.

    Comment by gallir — Sunday 16/10/2005 @ 14:05

  212. Oh, it is a bug with Blix theme !!! So, I edit head.php to match the correct value. I think you are right.
    In Blix theme, it is written: meta http-equiv=”Content-Type” content=”UTF-8” instead of what you suggested.
    So, I take what it is written in the header.php file (line 5) of the Default theme, and paste it to the Blix theme. I will test it thouroughly and tell you if it is fine. Thanks.

    Comment by Ralph — Sunday 16/10/2005 @ 15:52

  213. Hi, is the compatibility problem with theme-switcher resolved?

    I’ve installed both WP-Cache and Theme-Switcher (http://dev.wp-plugins.org/wiki/ThemeSwitcher). When they are both activated, the server gives me the previous theme (or something rather unpredictable) when processing URLs with the theme selection parameter:
    http://SiteName/index.php?wptheme=THEMENAME
    When processing inner pages with no wptheme parameter (eg. http://SiteName/archives/cat/article-slurt/), the server always sends me the default theme.

    I noticed that there were some discussions about this issue in the previous comments. Is this problem resolved?
    Thanks! :)

    Comment by epicure — Monday 17/10/2005 @ 5:52

  214. Huum.. I just took a look to the plugin, it uses cookies to store the selected plugin. Wp-cache takes them in account but only if they have the word “wordpress” in the name, which is not true for the plugin.

    So, rename the cookie in the plugin from “wptheme” to something like “wordpresstheme”, or change function wp_cache_get_cookies_values in wp-cache.

    Note: I cannot add all plugins’cookie names in the “official” wp-cache, it will be just too large and chaotic.

    Comment by gallir — Monday 17/10/2005 @ 10:38

  215. I changed the function wp_cache_get_cookies_values() in wp-cache-phase1.php (line 66) from
    if (preg_match(”/^wordpress|^comment_author_email_/”, $key)) {
    to
    if (preg_match(”/^wordpress|^wptheme|^comment_author_email_/”, $key)) {
    and now it seems to be working fine.

    Thank you!