Support » Fixing WordPress » WP 2.2.1 wp_cache 2.1.1 php 5.2.3

  • Hi there!

    Today I run into a problem with wp-cache 2.1.1.
    After upgrading PHP to 5.2.3 it became clear that caching doesn’t work as expected.
    Cache files were generated, but not used in following page requests.
    I managed to fix this issue this way:

    1. change wp-cache code (wp-cache-phase2.php)<br>Find this:
      	if ($new_cache) {
      		$serial = serialize($wp_cache_meta_object);

      and replace with:

      	if ($new_cache) {
      		$serial = serialize($wp_cache_meta_object);

    2. make sure that last line in your footer.php of your theme contains:
        while (ob_end_flush()) { }

    After these changes wp-cache seems to work as earlier.

    Did anyone encountered similar problem? What was your config?

    Info: This problem is caused by register_shutdown_function(shutdown_function) and ob_start(ob_callback_function)
    In wp-cache there was assumption that ob_callback_function will be executed before shutdown_function. After upgrading to PHP 5.2.3 this was opposite. But forcing ob_end_flush() at the end of template brought back proper order.

    Maciek Kus

Viewing 12 replies - 1 through 12 (of 12 total)
  • maciekkus,

    I’ve just started having an issue where the www version of my site sometimes wont load (blank page) until i clear the cache.

    Im using wp cache 2.1.1 and PHP is 4.4.

    Should I try the fix you outlined above??


    try to find ob_clean() in wp-cache-phase2.php and replace it with ob_flush()

    You will find other answers to your problem on this forum too. (more detailed)


    Unfortunately, ob_clean/ob_flush isn’t included in my version of Wp cache which I believe is the latest version.

    I’mm have to keep digging. Thanks!

    maciekkus –

    I’m having very weird issues with WP-Cache, using PHP 5.2.1 on OS X Server. The behavior seems intermittent. On some days, I found that the cache dir is populated and the WP-Cache admin shows the files cached, but live pages are not actually be served from cache. On other days (today) I find that the cache dir is populated, but no pages show as cached on the WP-Cache back-end and no pages are served from cache. Yesterday everything was happily working, but today it’s broken again. Very weird.

    I’ve made the changes you recommend, but no dice – just can’t get it working today. Further suggestions very welcome. Any word on whether Automattic might pick up and integrate this code? This is a critical component, which I feel should be in core.

    Ooh – I just upgraded PHP from 5.2.1 to 5.2.2 and the problem went away. I see from the changelog that they addressed some issues with output buffering in 5.2.2 and that seems (seems) to have fixed this issue. Crossing fingers that this is it.

    I spoke to a guy who has used a fix for this issue it seems. Not sure if it’s exactly the same thing, but I’m going to give it a try:

    Interesting read. However, I have not experienced the “blank page” or “corrupted cache” phenomenon described in various places. In my case, I simply wasn’t getting pages cached. Or rather, cached pages were showing up the cache directory, but viewing source at the end of the page (after reloading) often did not show “Served from cache” – it was simply failing to load the cached version of the file most of the time. The PHP upgrade fixed that.

    Separately, this caching business is not just a convenience – it’s a critical piece of functionality for a lot of sites. The fact that the WP-Cache developer has shut the project is very bad news. Any word on movement from automattic to incorporate this kind of genuine caching into core? If WP 2.3 or whatever breaks WP-Cache, a lot of high-traffic / high-vis sites are going to be royally screwed.


    Yes, that is my fear! If I don’t have Wp Cache enabled, my server load goes through the roof at peak traffic times, and I have a dedicated server!

    If caching was to no longer work at all, I don’t know what I would do at this point. I would be forced to add more servers??

    I’m frankly VERY surprised WordPress doesn’t make this some sort of priority because of the ramifications of large sites (as you mentioned).


    BTW…what version of PHP did you upgrade to?

    racerman: As above:

    I just upgraded PHP from 5.2.1 to 5.2.2

    Hi shacker,

    Just checking in with you to see if the upgrade to PHP 5.22 is still giving you good results (no Cache issues)?

    racerman – So far so good – no more issues that I’ve encountered.

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘WP 2.2.1 wp_cache 2.1.1 php 5.2.3’ is closed to new replies.