WP-Cache 2.1
Several people have had problems with previous version of wp-cache. Others have complained that wp-cache didn’t work with Wordpress 2.1., which was not the real problem Jih-Kai Liang finally found the bug, thanks:
After some investigation today, I found out that the callback sequence in php5 are changed from php4.
In php5, wp_cache_shutdown_callback() is call when page shutdown, and in wp_cache_shutdown_callback() it calls ob_end_flush(). When you call ob_end_flush(), it calls wp_cache_ob_callback() to process the buffer(since we register it with ob_start()).
So we can see wp_cache_shutdown_callback() is call earlier, and later the ‘$meta_object = new CacheMeta;’ statement in wp_cache_ob_callback() overrides the $meta_object, so the saved meta is always empty.
In php4, though I don’t understand why, wp_cache_ob_callback() are get called first. Then wp_cache_shutdown_callback() will be called, so putting ‘$meta_object = new CacheMeta;’ in wp_cache_ob_callback() will lead to correct results.
That’s why php5 users are good with 2.0.21, but php4 users are good in 2.0.22.
The new 2.1 version solves this problem by moving the creation of the MetaCache obect to the start of the whole process.
It has been also tested in WP 1.5, WP 2.0 and WP 2.1 running PHP 4.3 and PHP 5.2 on Apache 1.3 and Apache 2.2, in different servers’s configurations (dedicated and Dreamhost).
So, I hope it would finally solve any outstanding problem. Enjoy it
Download version 2.1.0.
The wp-cache-2 page.
WP-Cache 2.1
Últimamente me paso más ratos instalando nuevas versiones de WP-Cache que buscando nuevos blogs que leer, es lo que tiene hacer de beta-testing ;).
WP-Cache 2.1 viene a corregir problemas con PHP5 (versión que cambio el comportamiento de las llamad…
Trackback by SigT — Thursday 1/2/2007 @ 3:09
I was quite excited to see this!
But perhaps I’m confused. I was hoping that comments on a post would refresh the cache? Is that not the case?
Comment by Handy — Thursday 1/2/2007 @ 6:22
Hi Handy,
i`ve tried it and it refreshes the cache if a comment is posted.
Comment by Lazy — Thursday 1/2/2007 @ 7:31
Hi handy,
1.You need to click ‘delete cache’ first, then try again.
Old meta file could contain incorrect values.
2.If you’re using spam karma 2, it’s normal that the cache won’t flush.
Try this plug-in
Comment by priv — Thursday 1/2/2007 @ 14:26
1. Made sure cache was cleared out before I turned on 2.1
2. Why yes, I am running SK2. Will have a look at the plugin - thanks for that tip.
Comment by Handy — Thursday 1/2/2007 @ 16:27
Ricardo, I host my site on a clustered enviroment, and they do not permit symbolic links… This means that I cannot use wp-cache at all?!
Comment by Borbs — Thursday 1/2/2007 @ 16:49
#6 Borbs, instead of symlinking, you can copy wp-content/plugins/wp-cache/wp-cache-phase1.php to wp-content/advanced-cache.php.
If this is the case, remember to copy again the file if the plugin is upgraded.
Comment by gallir — Friday 2/2/2007 @ 0:15
How To Fix WP-Cache And Spam Karma 2 (SK2) Issues
WP-Cache and Spam Karma 2 are two of the most popular WordPress plugins. If I had to estimate, I would say that at least 30% of WordPress users are using at least one, if not both of these plugins.
Recently there has been a problem with WP-Cache not f…
Trackback by Connected Internet — Friday 2/2/2007 @ 1:10
I cannot make wp-cache with a post hit counter. All I need to do is serve posts from the cache (which works perfectly) and keep the post hit counter function call dynamic but I get an error that says the function is not recognized. The post id global variable is also needed for this operation.
My questions are:
1- Why cannot we place dynamic calls to plugin functions?
2- Is the post id variable active while serving post pages from the page?
Comment by Orhan — Saturday 3/2/2007 @ 5:56
#9:
> 1- Why cannot we place dynamic calls to plugin functions?
Because WP should be fully loaded and executed to allow calling plugins, which will make wp-cache useless at all. What you need in this case is a bigger server, not wp-cache (or a function that is implemented independly from wp plugin interface).
> 2- Is the post id variable active while serving post pages from the page?
You mean from cache? Not at all. WP was not fully loaded and there were no resquests to the database.
Comment by gallir — Saturday 3/2/2007 @ 15:36
As soon as I enable this plugin, the following error messages appear when I try to load my site:
Warning: sem_get() [function.sem-get]: failed acquiring SYSVSEM_SETVAL for key 0×152b: Permission denied in /mnt/cr1/08/947/00000017/htdocs/wp-content/plugins/wp-cache/wp-cache-phase2.php on line 98
Warning: sem_get() [function.sem-get]: failed releasing SYSVSEM_SETVAL for key 0×152b: Permission denied in /mnt/cr1/08/947/00000017/htdocs/wp-content/plugins/wp-cache/wp-cache-phase2.php on line 98
Any idea what the reason could be?
Comment by saarpreme — Sunday 4/2/2007 @ 10:08
try to use flock? (enable flock in wp cache config file)
maybe it works..
Comment by Lazy — Monday 5/2/2007 @ 10:44
Thanks, i enabled flock and it works now. I don’t know what it does, but it’s ok as long as it works
Comment by saarpreme — Monday 5/2/2007 @ 18:52
Hi,
what about gzipping the cached page? Adding ob_start(”ob_gzhandler”); before the “readfile” in phase-1 should do the job, right?
Best regards,
Arne
Comment by Arne Brachhold — Monday 5/2/2007 @ 23:30
No so easy, there are infinite combinations of PHP, apache and cgi/modules out there. It’s a wild wolrd.
On the other hand wp-cache should keep both versions, compressed and uncompressed and detect from the header which should be sent.
Comment by gallir — Monday 5/2/2007 @ 23:48
Hi gallir,
yes, you are right.. introducing a feature like this would need a lot of testing. Well, I tried it with my blog and since it works I’m happy with it
Best regards,
Arne
Comment by Arne Brachhold — Tuesday 6/2/2007 @ 9:47
Hello,
I am here to report a serious problem when trying to use it with wpmu,
It seems the configuration of your plugin is written to a file, so imagine it being used in wpmu: several 100 or 1000 of blogs, and if someone decides to disable the cache he disables it for every blog… could you mabe modify your plugin so that the config file is separately written for every blog to his blogdirectory?
the whole thread about this is located here: http://mu.wordpress.org/forums/topic.php?id=2296&replies=27
Comment by ovizii — Wednesday 7/2/2007 @ 9:03
Hi, I installed the plugin and everything was fine. But then I encountered a problem I didn’t think of before: I’m using password protection for some of my blog posts. That means actually there are two different ways to display the same page but only one will be cached.
Have you got any idea how to tell the plugin to exclude the password protected posts from being cached?
Henning
Comment by Henning — Wednesday 7/2/2007 @ 16:34
Well; this was a bloody beginners mistake. There is the big box for exclusion strings. I added the whole URI - and surprise, surprise - it works!
Comment by Henning — Wednesday 7/2/2007 @ 16:43
WP-Cache 2.1 revisited: Compression
I ran into an interesting post from Nick Georgakis in which he presents both an in-depth discussion and working code to properly enable compression with WP-Cache. The main idea is, that in order to support compression, WP-Cache must keep compressed …
Trackback by Reiner Saddey's Place — Sunday 11/2/2007 @ 16:54
I need help.
I’ve tried WP-Cache 2.0.22 on WP 2.0.2 and WP 2.0.7
I’ve tried WP-Cache 2.1 on WP 2.0.2 and WP 2.0.7
I’ve followed all the instructions closely, did some fresh reinstalls of WP-Cache, tried it with my other plugins disabled but i keep running in the same problem:
It does not cache. Whenever I refresh pages of my site, I don’t see any added code on the bottom of the sourcecode. When I look at the WP-Cache admin, the numbers of pages stays on 0. When I look in the wp-content/cache folder, the only file I see is wp_cache_mutex.lock
Yes, I’ve enabled WP-Cache. Yes, I’ve tried any possible permission codes on every file. It just does not work.
Server info:
Apache
FreeBSD 5.4
PHP Version 4.4.2
HELP!!!
Please respond, if someone wants to email me with possible solutions: dawouz excite com
Comment by wcp — Wednesday 14/2/2007 @ 1:08
try to change the theme and look if pages are cached then.. sometimes the theme make it possible, that no page cache is shown in the wp-cache option.. and try to look at the source code of a page from you after reloading (bottom).
Comment by Lazy — Wednesday 14/2/2007 @ 8:22
Hm, seems to work partly: The Mainpage is Cache but when I go to one specific article it seems that this one will not be cached. On the server I can see the .html File but no .meta file is created for these article-pages…
Comment by red — Wednesday 14/2/2007 @ 10:49
Is it possible to set something that means admin users will never get served cached pages? Thanks.
Comment by WP — Wednesday 14/2/2007 @ 11:25
Just when I thought it was working… With WP-Cache 2.1 enabled, feeds are getting served as text/html. PHP 5.2 on Apache 1.3 as mod_php. Yes, I’ve emptied the cache.
I can resolve it by moving the ob_end_flush() call in wp_cache_shutdown_callback to the line before $response = wp_cache_get_response_headers();
Comment by Kelson — Wednesday 14/2/2007 @ 23:41
#25, good point, i’ll check it out later (php versions and hosting madness are a pain in the ass).
Comment by gallir — Wednesday 14/2/2007 @ 23:52
FYI, the fix I used to solve the Content-Type problem worked… but now 304 Not Modified responses don’t work. Reverting back to an earlier version until I can look at it in more detail.
Comment by Kelson — Thursday 15/2/2007 @ 2:27
Hi,
i’ve a problem. I’ve installed step by step this plugin, then i’ve activated it but when i go to the option page there isn’t anything..Blank Page. Ther isn’t submenu. What’s the problem? I’ve installed WordPress 2.0.5 over WAMP Server (Apache).
Thanks a lot.
Freddie
Comment by Fede — Thursday 15/2/2007 @ 16:32
Can’t login back into wordpress at all once installed.
this shows up on my login page:
Warning: Cannot modify header information - headers already sent by (output started at /home/wlfxymb/public_html/createvalue/wp-config.php:43) in /home/wlfxymb/public_html/createvalue/wp-login.php on line 9
this shows up once I try to login:
Warning: Cannot modify header information - headers already sent by (output started at /home/wlfxymb/public_html/createvalue/wp-config.php:43) in /home/wlfxymb/public_html/createvalue/wp-login.php on line 9
Warning: Cannot modify header information - headers already sent by (output started at /home/wlfxymb/public_html/createvalue/wp-config.php:43) in /home/wlfxymb/public_html/createvalue/wp-includes/pluggable-functions.php on line 308
Warning: Cannot modify header information - headers already sent by (output started at /home/wlfxymb/public_html/createvalue/wp-config.php:43) in /home/wlfxymb/public_html/createvalue/wp-includes/pluggable-functions.php on line 309
Warning: Cannot modify header information - headers already sent by (output started at /home/wlfxymb/public_html/createvalue/wp-config.php:43) in /home/wlfxymb/public_html/createvalue/wp-includes/pluggable-functions.php on line 270
Comment by SERIOUS PROBLEMS — Saturday 17/2/2007 @ 4:07
Gallir,
I want to use this plugin, but it only caches feeds. Is there a solution?
WP 2.1, PHP 5.1.4, MySQL 4.1.22, WP-Cache 2.1.
Comment by Jonathan — Saturday 17/2/2007 @ 9:31
How to prevent WP-Cache from changing a Feed’s Content-Type to text/html
After upgrading to WP 2.1, Kelson had to downgrade WP-Cache 2.1 to a tweaked 2.0.17, because with RSS feeds WP-Cache 2.1 would, when serving a request from its cache, always return Content-Type text/html instead of Content-Type text/xml.
Why do…
Trackback by Reiner Saddey's Place — Sunday 18/2/2007 @ 12:00
wp_cache_get_response_headers() function patch
I noticed that with with my hosting provider, apache_response_headers and headers_list are not supported which prevents wp_cache_get_response_headers() (defined in wp-cache-phase2.php) from working properly. Here is my fix:
function wp_cache_get_response_headers() {
if(function_exists(’apache_response_headers’)) {
$headers = apache_response_headers();
} else if(function_exists(’headers_list’)) {
$headers = array();
foreach(headers_list() as $hdr) {
list($header_name, $header_value) = explode(’: ‘, $hdr, 2);
$headers[$header_name] = $header_value;
}
} else
// Comment this out
// $headers = null;
{
// Add those lines
$headers = array();
$headers[’Expires’] = ‘Wed, 11 Jan 1984 05:00:00 GMT’;
$headers[’Cache-Control’] = ‘no-cache, must-revalidate, max-age=0′;
$headers[’Pragma’] = ‘no-cache’;
$headers[’X-Pingback’] = get_bloginfo(’pingback_url’);
}
// End add those lines
return $headers;
}
Also in my case, I needed to insert the following statement in line 39 of wp-cache-phase1.php to prevent the page from being cached by the browser:
@header(’Last-Modified: ‘ . gmdate(’D, d M Y H:i:s’) . ‘ GMT’);
/phil
Comment by Phil — Monday 19/2/2007 @ 21:18
How to totally clear the cache every day at a set time?
My site gets updated every day at midnight central with a new post and I was wondering how to clear the cache automatically at that time. I thought of running a cron job calling a php script but I am not sure what function to call in that php script. Any suggestions?
Comment by Phil — Tuesday 20/2/2007 @ 0:47
The relevant cached files are deleted automatically when a a new article or comment is posted.
Nevertheless, if you want to clean the cache entirely it’s enough to delete all files inside the cache directory, you don’t need any php program, justa “rm -f …./cache/*” in your crontab.
Comment by gallir — Tuesday 20/2/2007 @ 1:20
What about articles posted in the future?
Thank you gallir.
In my case, all articles are posted in the future (one day apart) and as each day goes by a new article gets automatically displayed by Wordpress at midnight. Does this mean that the cache will be automatically cleared or should I clear it myself?
Comment by Phil — Tuesday 20/2/2007 @ 2:10
WP-Cache 2.1 and wordpress 2.1 together does not work for me. Every other refresh gives me an internal server error. I have even tried a separate fresh wordpress install, and it does the exact same thing. I currently have it disabled, but I would very much like to use this plugin.
Any ideas?
Comment by Joe — Wednesday 21/2/2007 @ 0:00
Hi there,
first I thought WP-Cache does not work - because when checking it with different browsers, every visitor seemed to produce an individual caching. But I was wrong - it depends on the browser that is used …
Now I’ve noticed something funny: I have a Search Hilighting plugin in use - and I have found some pages that always have some hilighted words in it. So these were pages, people have found via Google. But as many visitors come from search engines, my site was getting more and more coloured.
Two questions from me:
1) I want WP-Cache saving just one page for all browsers.
2) I have to make WP-Cache refuse caching when the referrer is MSN, Google or something like that. Also WP-Cache should not serve cached contents, when visitor comes from a search engine, as I’d like to stay my hilighted search terms in use.
Can you please give me a hint where to search in the Code?
Greets,
Gunnar
Comment by pufaxx — Thursday 22/2/2007 @ 8:41
Running into a minor problem with WP-Cache. My sidebar contains links to my categories; when they change for posts, the cached posts are updated, but the sidebar is also displayed on pages, and those are not updated when the sidebar is.
I’m using WP-Cache 2.1 on WordPress 2.0.7, 2.1, and 2.1.1; I’ve seen this under PHP 5.2, and… I’m not sure what version of PHP5 it was running prior. (I’m on Dreamhost, though, so you should know.
)
Comment by Andrew Timson — Friday 23/2/2007 @ 10:29
I had the same problems with the Internal Server Errors. Removing WP-Cache solved them. My host said it had something to do with excessive memory usage. Sad.
Comment by FanTent — Sunday 25/2/2007 @ 21:32
is there a way to make wp-cache work with eaccelerator on a better way? e.g. using eaccelerator tags in it?
Comment by Lazy — Wednesday 28/2/2007 @ 15:48
My site gets stuck after a few hours of wp-cache use. I check the options and always find that the cached pages and expired pages number is equal. I just disble wp-cache and site works. The I reenable it. There seems to be some problem when the numbers get equal. You might want to fix that.
Comment by jai — Sunday 4/3/2007 @ 17:43
For anyone who’s host has the symlink function disabled, and can’t get the plugin to work after trying everything else, I’ve made a fix here: http://twentythree7.com/wp-cache-nosymlink/
Comment by Brandon — Monday 5/3/2007 @ 8:29
Some of my readers tell me that when they view my posts, other people’s information appears in the Name: and Website: fields in the comment form. How to fix this?
Comment by Michael Hampton — Monday 5/3/2007 @ 20:19
I tried installing the latest WP-Cache (2.1?) with Wordpress 2.1.1. It does not work, every page hit that it tries to get from the cache causes a 500 internal server error. If I reload, this somehow forces it to regenerate, and everything works fine. So basically every other page hit gives a 500 server error.
Using GoDaddy hosting.
Comment by Otto — Wednesday 7/3/2007 @ 6:34
[…] WP-Cache - Creates a cache of your posts, helping your website to survive being Dugg. […]
Pingback by Best of: Wordpress Plugins — Thursday 5/4/2007 @ 4:11
I too have had the same problem with the every other page being an error. I tried manual vs auto install, no-symbolic link alternative, etc. No love. Seems every time it tries to load from the cache it is an error, and on the subsequent “live” load it works. I would really like to see this work, but I am stumped. Oh yeah, using the latest 2.1.3 build of WP and everything else updated. GoDaddy hosting too, so that seems to be something in common.
Comment by Jeremy — Thursday 5/4/2007 @ 20:29
[…] plugin to make it think all browsers were phones. It seems the WP-Cache plugin I use is incompatible with both the mobile edition plugin and the Wii […]
Pingback by Steve Wills Weblog » Blog Archive » Wordpress Plugin incompatibility — Sunday 8/4/2007 @ 19:24
i’m also having the issue of the plugin only caching the feed on my site. i’ve re-installed and even tried a manual install. i’mm running updated versions of the plugin and wordpress.
any suggestions would be great. thanks
Comment by mike — Wednesday 11/4/2007 @ 20:54
[…] seen this before, but if you’re not using the WP-Cache plugin, we shouldn’t talk. It serializes your posts to a file on disk and later spits them […]
Pingback by Why My Wordpress Site Is So Much Faster Than Yours by Elliott Back — Monday 16/4/2007 @ 3:25
Has anyone tested with WP-2.2-bleeding? It is due out in a week, so I figure it might be good to find out ahead of time. It seems there is already a cache directory under wp-content and when I installed all I got were blank pages leading me to disable WP-Cache.
Comment by Ernie Oporto — Tuesday 17/4/2007 @ 4:19
[…] caching on WordPress, download and install the WP-Cache […]
Pingback by Improving performance by 87% at b5media using a cache, optimization, and a screwdriver | King Gary — Tuesday 17/4/2007 @ 23:06
[…] WP-Cache 2.1 (Ricardo Galli, de software libre) : […]
Pingback by Present Tensed » Links/Articles that Intrigued Me between April 16th and April 19th — Friday 20/4/2007 @ 3:10
[…] Ricardo Galli, de software libre » WP-Cache 2.1 wp-cache wordpress plugin (tags: wordpress plugin cache plugins) […]
Pingback by links for 2007-04-20 « GroundupHipHop — Friday 20/4/2007 @ 18:37
[…] Ricardo Galli, de software libre » WP-Cache 2.1 wp-cache wordpress plugin (tags: wordpress plugin cache plugins) […]
Pingback by links for 2007-04-20 « Hip Hop News — Friday 20/4/2007 @ 18:42
[…] Link to Ricardo Galli, de software libre » WP-Cache 2.1 […]
Pingback by wehuberconsultingllc.com » Blog Archive » Ricardo Galli, de software libre » WP-Cache 2.1 — Monday 23/4/2007 @ 1:26
Ricardo,
I have made substantial progress on getting your plugin to work with WPMU. However, I’m still having a problem where I’m getting the following error:
Warning: fopen(/home/…/public_html/wp-content/blogs.dir/83/files/cache/) [function.fopen]: failed to open stream: Is a directory in /home/…/public_html/wp-content/plugins/wp-cache/wp-cache-phase2.php on line 96
This puzzles me because all I have done is changed the paths from /wp-content/cache/ to /$userdirectory/cache/. I can even see inside each user’s directory that the ‘cache’ dir has been created.
Why then am I getting this error? BTW you can follow along on my progress here:
http://mu.wordpress.org/forums/topic.php?id=2296&page=2&replies=33#post-26262
Comment by suleiman — Monday 23/4/2007 @ 10:47
#56, check the variable $mutex_filename has been assigned.
OTH, wp-cache does work in WP-MU, what’s your problem?
Comment by gallir — Monday 23/4/2007 @ 12:48
Ricardo,
wp-cache is unuseable with wpmu out of the box. With the default settings the plugin does activate and does cache files, but because the config file is located in the /wp-content/ directory, anyone who makes changes to the plugin options page can re-write what other people have set.
Additionally after activating it the cache for one website is served even when other websites (without cache enabled) are called. So If i activate it for our main site then the mainsite will display even when users point their browser directly to their personal blogs.
I tried to resolve both of the above problems by putting the wp-cache-settings.php file in the user’s blog directory. I also tried to put the cache folder in each user’s blog directories.
But I keep getting fopen error listed above.
Comment by suleiman — Monday 23/4/2007 @ 18:18
I’m also looking for a wpmu fix - any idea?
-Ross
Comment by Free Net Publishing — Saturday 28/4/2007 @ 11:26
[…] adding new buttons, forms, menus, and sub-menus.Update Manager - Checks for updates to your plugins.WP-Cache - Creates a cache of your posts, helping your website to survive being Dugg.WP-Contact Form - Helps […]
Pingback by WordPress Plugins Tested | my-whiteboard — Sunday 29/4/2007 @ 0:02
Right, I too have the same problem with Error 500 on Godaddy Hosting. When I take a look at the error logs there’s nothing useful. I guess I have to dig deeper then.
Comment by Ady — Monday 30/4/2007 @ 3:57
hei Gallir could you take a look at the thread #17 posted and give a hand so the plugin works with WP-MU? Pretty please
i bet there are alot of people waitting for this and some are even trying to fix it but no luck so far
Keep up the good work, thank you
Comment by WeirdAl — Monday 30/4/2007 @ 23:02
[…] I have just installed another Wordpress plug-in called “WP-Cache“. […]
Pingback by WP-Cache now Live | Fird’s Domain — Thursday 3/5/2007 @ 5:35
[…] I have just installed another Wordpress plug-in called “WP-Cache“. […]
Pingback by RagnarokRP.com » Blog Archive » WP-Cache now Live — Thursday 3/5/2007 @ 6:07
any progress on the WPMU issues I pointed out in comment 56?
I’m nearly there. Just getting stumped on one error.
Comment by suleiman — Wednesday 9/5/2007 @ 7:47
[…] with SSI, as do the blog pages in general, and in particular the admin pages. Looking around, the wp-cache plugin might be an option for better […]
Pingback by joshblog » Blog Archive » Making a start — Friday 11/5/2007 @ 16:04
Hi Ricardo, I’m author of a plugin (http://wp.uberdose.com/2007/03/24/all-in-one-seo-pack/) that uses ob_start() and the like to rewrite titles on the fly. Several users have brought up the case that our plugins are not working together
On a local testing machine I notice as soon as I’m activating my plugin (and issuing an ob_start()), wp-cache doesn’t output any pages anymore. Instead, they are output uncached by Wordpress. Do you know why this is the case or any workaround?
Comment by uberdose — Friday 11/5/2007 @ 20:49
Hi, I just tried installing wp-cache for the first time. I’m using the latest version of Wordpress and this newest version of wp-cache. On my development server on my laptop using php-5.2.1, everything works great. On my host which uses PHP version 4.4, wp-cache doesn’t work. The plug installs nicely enough. I get no error messages. The blog stil works just fine. However, nothing is ever cached. No matter what I do, it always says 0 cached pages, 0 expired pages. I’m going to upgrade the machine to php5 in the near future, but it would be nice to have wp-cache working now. If anyone knows the fix, please help.
Comment by Apreche — Monday 14/5/2007 @ 17:01
I am having the same problems as Apreche (comment 68). If anyone knows how to make the plugin start caching posts and not just feeds I would very much like to hear it.
FWIW the plugin was working fine until some time in the last week or so. It still works fine on 2 other sites I run from the same server so I don’t think it’s anything to do with php. It has me stumped.
I’m looking forward to getting this fixed
Thanks for any help in advance.
Comment by Ben — Friday 25/5/2007 @ 14:59