Adventures with WP-Cache2 & APC

Update 3: see update 2 for the solution!

APC (Alternative PHP Cache) is great for WordPress. It caches the compiled WordPress PHP files and greatly speeds up subsequent loads. I even wrote a WordPress plugin to make WordPress store its objects in APC instead of in the default file-based object cache.

WP-Cache2 is also great for WordPress, because it caches the HTML output of WordPress for a specified period.

So if both are good, together they should be awesome, right? Well… in theory, yes. Unfortunately, I’ve been having a heck of a time getting them to play together. What would happen was that pages would start showing up blank. Just a white page. Real helpful. The same thing happened when you tried to access /wp-admin/ The only way to fix it was to delete WP-Cache2. In desperation, I removed all the error-silencing @ from WP-Cache2. Ah. It was some problem with class_exists() and APC. Apparently, APC doesn’t play well with class_exists().

Here is the solution I came up with… it seems to be working. I’ve been able to enable/disable WP-Cache2, restart Apache2, flush APC, with no White Page of Death so far!

[ I have removed my solution, to keep from misleading people, as it gave me problems later on ]

Restart Apache, flush your WP-Cache2 cache, and cross your fingers. I’ll update if I have any problems with this.

Update: Well that was short-lived! I’m still looking for a solution. It may involve naming the wp-cache-config.php file differently for each WP install that is running WP-Cache2.

Update 2 (SOLUTION): This seems promising. In php.ini in the [apc] section I set apc.filters = wp-cache-config which should exclude wp-cache-config.php and wp-cache-config-sample.php from being cached by APC.

Update 3: Yep! That did it!

289 thoughts on “Adventures with WP-Cache2 & APC

  1. Good luck with this =). I will be keeping an eye out to see what you come up with and I just hope that there is a solution that doesn’t require access to php.ini (although I know some php.ini settings can be changed from within a script itself, kind of like how .htaccess can change httpd.conf settings).

  2. Same configuration, almost the same problem. I did this:

    apc.filters = “-.*cache.*\.php”, “podpress\.php”;

    podpress wasn’t working for me…

  3. Aha. That’s what I needed. I was just trying to install APC today, and ran into the blank-page problem. Filtering out wp-cache-config seems to have things working. I wonder why it conflicts like that?

  4. WP-Cache2 declares a class conditionally… and apparently APC doesn’t do well under those circumstances. I believe the error was due to the class not existing, because APC thought it didn’t when it should have. Blank page because errors are all turned off and everything is @silenced. I experimented with all sorts of things to make it work, but with no luck. This might change as APC matures… I hear it is under consideration for PHP6, but for now, filtering out wp-cache-config is a viable workaround.

  5. Pingback: sitepoint Blog
  6. How about something like PHPA which is also free and has gotten good reviews.

    http://www.php-accelerator.co.uk/

    It’s supposedly better than zend and yahoo uses it.
    Works with php 4.4.1 too.

    I don’t have it (or root) on my current host or I’d try it, but I’ve had it on previous hosts and it’s transparent.

  7. I am running the latest APC and WP-Cache and I’m getting the ‘white page of death’ error. I have tried a variety of filter settings in apc, flushing the wp-cache, and restarting apache. No luck yet. Mark – do you have WP-Cache successfully working with APC? As of now, I’m just going to use APC.

    Any other suggestions?

  8. Unfortunately, no luck here as well. Just as Ben’s problem; blank screen on first load, but subsequent loads work. I have removed all error suppressions from all wp-cache files. Even my log files are completely clean (after a couple file_exists() additions to the code. I’m still troubleshooting though…

  9. Solution has been discovered! I have posted the solution on my blog for details, but so you know I’m not link spammin ya, here’s how: Edit wp-cache-phase2 list 219. Change ob_end_clean() ob_end_flush().

    The problem is ob_end_clean() cleans out the buffer without actually flushing it to the screen and I don’t see any flush() calls before hand. Changing it to ob_end_flush() will end the output buffer and flush all data to standard out.

    I have tested this solution with and without APC and it seems to be working.

  10. Hi there,

    I was new to wordpress and those plugin staff. I had install this wp-cache plugin. I had enable the plugin from the optioin there.

    So how can i know that this plugin had take effect and how can i view the statistic thing?

    Anyhting to be check and any setting needed?

    Thanks

    Eric

  11. Pingback: SigT
  12. I am sorry for breaking WP-Cache/WP-Cache2 with APC … with a decent enough test case, that bug was fixed for good today (for php4, php5 having had that fix for months).

  13. I just found this. Interesting article as I am setting up a multi-server architecture for something unrelated to blogging and was investigation PHP opcode cache, APC and eAccelerator.

    I plan to host my own blog on my own server in a colo soon (in the near future) so I will let you know how it goes.

  14. was new to wordpress and those plugin staff. I had install this wp-cache plugin. I had enable the plugin from the optioin there.

  15. veri kurtarma, data veri kurtarma, veri kurtarma indir, kurtarma
    programı, veri kurtarma programı, disk kurtarma, disk veri kurtarma, veri kurtarma full, data
    recovery, veri kurtarma format, silinen veri kurtarma, hdd veri kurtarma, silinen dosyaları
    kurtarma, data kurtarma, veri nedir

  16. How did you track down the error to that one file? I’ve got a server with APC which is serving blank white pages (with 500 status), but there’s nothing in the PHP or Apache error logs… most frustrating.

  17. I’m having the blank-page problem with WordPress 2.8.4 + APC without the WP-Cache2 plugin, does anoy one else had this problem before?
    What is odd, is that the blank pages just come from time to time, what I mean is the blog is working right now, but at any time it stars to serv blank pages, and then fix it by it self!

    1. Im am currently having that problem too. I just upgraded to APC 3.1.3p1 and PHP 5.2.11

      I am getting blank pages when I go to the admin area on all my installations.

  18. Sitemizde sesli görüntülü chat, kamerali sohbet chat, sesli sevgi, görüntülü sohbet, sesli dini sohbet, sesli sohbet siteleri, görüntülü sohbet, tikla sohbet,sesli chat, seslichat, seslisohbet, kamerali chat, sesli cet, kamerali sohbet, canli sohbet, sohbet odalari, sesli kamerali sohbet, sesli görüntülü sohbet, sesli chat sohbet, sesli kamerali chat, sesli dunya chat, sesli kamerali sohbet, sesli görüntülü sohbet

  19. space constraints prevent all comments from appearing. We will only approve comments that are directly related to the blog, use appropriate language and

  20. prevent all comments from appearing. We will only approve comments that are directly related to the blog, use appropriate language.

  21. As you have a blog about sharing was very nice.
    I host it and different places in search of an active subject.I thank you for informationn

  22. Thank you editors for the topic.Its include a lot of useful informations.i join this blog i couldnt see unnecessary arguments and it makes us happy thnx all moderator n editors.

  23. This post was very well written, and it also contains a lot of useful facts. I appreciated your distinguished way of writing

    the post. Thanks, you have made it easy for me to understand.

  24. Kosmodisk Classic Set, kan dolaşımını kolaylaştırarak yorgun kasların ısınmasına, yumuşamasına ve rahatlamasına dolayısıyla ağrıların azalmasına yardımcı olur.

  25. There is a more straightforward and general solution to eliminating the WordPress white screen of death issue when using APC Cache

    Since the problem appears to reside with include file(s)
    Set apc.include_once_override=0 in your /etc/php5/conf,d/apc.ini file

    Danny

  26. For information, thank you. However, I want to say something … I view some of the pictures on your site. Is there a problem?

  27. Facebook and leave it at that. It’s just software so like anything else, how it’s used depends on the person using it. Your personal informatio­­n is never yours if you use social networking­­. They hide that in the privacy policies, but it’s there.

  28. is getting all users to think about privacy, but the transition tool and other changes actually discourage or eliminate some privacy protections that Facebook users currently employ.

  29. Welcome to the Moncler Jacket Sale at moncler jackets- Moncler Jacket Sale,Cheap moncler coats for Women and Men are Provided In moncler coats sale

  30. it really should default to full lockdown. not everyone even knows about the security settings or reads about it.

  31. This also directly ignores the more than 1.5 million Facebook users in 24 groups who find the status updates of their “friends” annoying. There is every indication that it is in the worst interests of

  32. orge V in 1911 Much of the future of the Red and Black is played on this qualification for the C1, but at the crucial moment, things are emerging evil It was totally absent in the determination, there is always next, late A deafening roar rises from the place

  33. I just wanted to comment your blog and say that I really enjoyed reading your blog post here.
    It was very informative and I also digg the way you write!All of them make sense and are very helpful. Keep posting.

  34. çok Kırmızı ve Siyah geleceği C1 için bu yeterlilik üzerinde oynanan 1911 yılında V orge kritik bir anda, her şey bu belirlenmesinde tamamen yoktu kötülük ortaya çıkmakta, her zaman yanında, geç bir sağır kükreme yükselir var yerden

  35. I would like to point out my gratitude for your generosity for men and women who actually need help with this particular issue. Your special commitment to passing the solution around was extremely powerful and have all the time enabled others like me to realize their targets. Your amazing helpful guideline can mean this much to me and further more to my mates. Many thanks; from each one of us.

  36. After study a few of the blog posts in your website now, and I actually like your approach of blogging. I bookmarked it to my bookmark web site list and can be checking back soon. Pls check out my website online as nicely and let me know what you think.

Comments are closed.