Thursday, August 3rd, 2006...5:09 am by Leroy Brown
WP-Cache and the Blank Page problem
I’m a big fan of WP-Cache - in fact, it’s one of my Top 9 Wordpress Plugins. When I first installed it though, not all was well. I’m sure many of you have had the same problem, so I’m going to address it here, and offer the simple solution.
If, after enabling WP-Cache, all your pages fail to load, then you have a problem. You can only see the page after you reload it - not acceptable! Fortunately, the solution is very simple, and not very techy. Here goes.
Open up the WP-Cache folde, and look for a file called wp-cache-phase2.php. This is the offending file that is causing the problem. Open it up, and do a search for “ob_end_clean()”. Once you find it, simply replace that phrace with “ob_end_flush()”. Save the file, re-upload it and overwrite the existing file, and you’re done. Your pages should load flawlessly, and a bit quicker to boot.
Why is this fix necessary? Well, WP-Cache was written for php4, and many people now have php5 on their web server. PHP 5 needs the ob_end_flush() command to work correctly.
36 Comments
August 5th, 2006 at 9:30 am
Wow! Thanks for posting this. It’s been bugging me for a while and I couldn’t figure out what was causing it on all of my test environments, but thankfully not on my production server. It turns out all my test environments are on PHP5 and production is on PHP4.
I don’t think I ever would have figured this out on my own. You’re a lifesaver!
August 5th, 2006 at 9:38 am
Daniel,
Glad I could help. This was a problem I had on about half of my blogs while the other half were working fine. Pretty annoying! It’s nice to have everything working smoothly now.
August 5th, 2006 at 9:41 am
One thing I am curious about is whether it’s safe to use the replaced version on PHP4. Do you happen to know? I know very little about PHP so the documentation about the differences between the two functions doesn’t mean much to me. I’m going to run a test with the new function against PHP4 - but if you have a sense for whether it should work that would help support my confidence
August 5th, 2006 at 9:47 am
That is a good question. I should have tried this out already, but I haven’t yet. I’m stuck at work today, so no ftp access to give it a shot. Well, this phone probably could do ftp but it isn’t set up for it just yet.
Anyway, I should have some time to give it a go tomorrow, unless you feel adventurous before then :). If you do, keep me posted.
August 5th, 2006 at 10:31 am
Leroy: I tried it against php4 and it “seems to work fine.” Sounds like a good fix to keep for all installations, to be prepared for a php5 update.
August 5th, 2006 at 11:33 am
Awesome! Thanks for testing it out. Saved me some time :).
August 22nd, 2006 at 7:35 am
[...] Link. [...]
August 25th, 2006 at 12:54 pm
[...] I found a very nice WordPress plugin called WP-Cache 2.0 coded by Ricardo Galli. It caches WordPress pages, therefore increasing page load times. I happen to have Fasterfox Page Load Timer installed on my Firefox browser and I noticed the pages load much faster now anywhere from .300 to .900 seconds. Prior to the cache, I was averaging 2-3 seconds for a WordPress page to load. Unfortunately, the plugin has a conflict with PHP5 displaying the annoying blank page. The good news is Bloggingblog.net has the fix! [...]
August 25th, 2006 at 8:33 pm
Parches para WP-Cache…
WP-Cache 2.0 es un sistema de cache de páginas realizado por Ricardo Galli (con algo de testeo y documentación por mí parte en los inicios
) imprescindible para aliviar la carga del servidor y los tiempos de carga de los blogs basados en WordPres…
September 25th, 2006 at 9:32 pm
Thanks! I appreciate the help.
September 26th, 2006 at 5:46 am
Glad I could help, sean.
September 29th, 2006 at 5:48 pm
[...] I recently installed the plugin WP-Cache and had a problem with the initial loading of pages. When a page is loaded the first time a user will see a blank page until reloading. This seems to be an issue with PHP5. Fortunately the and there is a fix at Bloggingblog.net! Explore posts in the same categories: Word Press [...]
October 2nd, 2006 at 10:03 pm
[...] Blogging Blog [...]
October 11th, 2006 at 3:38 pm
[...] WP-Cache and the Blank Page problem at Blogging Blog [...]
October 24th, 2006 at 1:19 am
Thanks so much for posting this. I was so frustrated wondering why all my pages were blank! This fix was so easy, thanks.
October 24th, 2006 at 6:00 am
Celeb - it made me want to tear my hair out too! Glad I could help.
November 5th, 2006 at 6:02 pm
I’ve just written a post that explains how to make wordpress pages faster and how to make better use of caching to protect against being ‘Dugg’ - worth having a look.
http://www.connectedinternet.co.uk/2006/11/05/1028/
November 8th, 2006 at 7:29 pm
iThankyou for the fix. The WP-cache plugin, which I’m now able to use, was actually the thing that made me want to use WordPress to run my site.
This page explains my strong feelings for this plugin from the perspective of somebody who hosts his site at home; http://devnulled.com/content/2005/07/surviving-a-slashdotting-with-a-celeron-466-my-slashdot-experience/
The machine I host my blog on is way faster than the celeron-box in the story, and even though my blog is mostly useless and never would be dug or slashdotted I find the whole idea of not caching dynamic content utterly insane.
November 13th, 2006 at 1:12 pm
Thanks for this tip, i was really hating the fact taht my web host told me that this had to be installed and then it was causing issues with the blog
Loving the plugin, thanks again for the tip.
November 18th, 2006 at 4:27 pm
[...] If anyone noticed problems with my blog in the last few weeks, the problem was a php5 issue. See this page. It’s really a shame that wp-cache isn’t built in to Wordpress. [...]
November 18th, 2006 at 7:51 pm
[...] I’ve just installed the wp-cache plugin, and it’s very much helped to speed up the site. If you’re running Wordpress without it, you might want to give it a shot. It effectively caches your pages and reduces the load time and server strain. You’ll also likely want to fix one minor bug with wp-cache, but it’s so easy to do, even a caveman can do it. [...]
December 12th, 2006 at 5:21 pm
[...] The problem and fix are also documented here. [...]
December 31st, 2006 at 3:48 am
[...] #516: Call ob_end_flush, not ob_end_clean, in phase 2 (not really relevant to the headers problem; it’s another one that’s been blogged about elsewhere) [...]
January 16th, 2007 at 11:33 am
[...] Solución: Dos horas después, la página vuelve a la vida. Caida de Dreamhost en su primer lunes importante. Si señor, valen lo que cuestan. Superado el cabreo, aplico el parche para wp-cache que soluciona el problema de las páginas en blanco con php5. Muy bien, sirve las páginas pero… [...]
June 13th, 2007 at 11:18 am
I’ve got the latest plugin and PHP, the ..flush.. thingy is already there at phrase 2, but I still get the blank page. Help?
June 22nd, 2007 at 4:23 pm
I’m in the same position as SainT. Help much needed and will be much appreciated.
June 22nd, 2007 at 8:25 pm
I am having the same problem, went to make your suggested change and noticed when doing a search and replace that there are a ton of files with this line of code - ob_end_clean(). Should this be done to all of these pages??? Thanks for the help in advance.
June 25th, 2007 at 6:59 am
posted a neat step-by-step guide to fix this for new wordpress users, had a run in with the white-screen of death while switching domain addresses and leaving wp-cache active while doing it.
http://www.red91.com/2007/06/25/flushing-wp-cache/
enjoy,
June 25th, 2007 at 11:24 am
Mark, John Q, did John G’s guide help you guys fix your problem?
June 26th, 2007 at 9:23 am
I still have problem.
Every second time I get “500 Internal Server Error”
What to change for that?
I’m using WP 2.2.1.
Also, can you write for some of us who are new with wordpress and wp.cache, what to write in sections:
1. Expire time:
2. Rejected URIs
3. Accepted files
I read what wp-cache have written but I’m still confused. Can You put you example?
Thanks.
July 13th, 2007 at 5:38 am
Actually my problem isn’t a failure of all pages to load, only some. I’ve deleted the cache in the hope that this will fix things, and I’ll also try rebuilding the permalinks. Thanks
July 31st, 2007 at 8:04 am
[...] helpful info, I discovered many bloggers who experienced the same exact problem in the past and managed to fix it. I know what’s causing it now and I hope to settle it asap. Thanks for your patience. [...]
August 18th, 2007 at 3:32 am
[...] upgrading to PHP5, then hit reload and it loads, then WP-Cache needs to be modified. Leroy has the fix, open wp-cache-phase2.php in your wp-cache folder and change ob_end_clean() to ob_end_flush(). [...]
August 18th, 2007 at 12:57 pm
[...] plugin or after upgrading your installation of PHP with WP-Cache still activated, then there is a quick and easy fix by altering a single line in the [...]
August 23rd, 2007 at 10:16 am
Same problem here, using WP 2.2.2 and No-symlink WP-Cache, I still get a blank page when reloading. Anyone has a clue on how to fix this? Thank you.
May 8th, 2008 at 7:45 am
The blank Wordpress admin page may have many causes. Look at this text to see another cause and its fix.
Leave a Reply