Occasional blank pages in Nginx + APC+ PHP-FPM (or PHP-CGI) + WordPress + WP Super Cache

25 03 2014

This is just a quick note on something I found recently that’s quite annoying to debug.  It’s difficult to narrow down the issue because you can’t find any error logs in PHP-FPM nor PHP error log.  So here is the behavior, your site works fine for a short period after starting PHP-FPM.  Then, all of a sudden, you see blank pages in some pages.  If you wait a while and try again, some blank pages will come back.  It appears the problem is gone, but when you refresh again, blank page will show up again.  You can also fix it temporarily by restarting PHP-FPM.  However, you will face the same issue again after the restart.  The annoying part is that you can’t find any error logs anywhere.  The only way to expose the error is setting WP_DEBUG to true in wp-config.php.  It can be set as followed:

define('WP_DEBUG', true);

If you are experiencing the same issue as I do,  you will see an error similar to follow:

Fatal error: Internal Zend error - Missing class information for in .../wp-content/plugins/wp-super-cache/wp-cache-base.php on line 5

Here is the content of this file wp-cache-base.php:

Line 5 points to “class CacheMeta {“.  What it looks like is that APC can’t cope with how this class is dynamically declared.  A workaround is add the following line in your php.ini file.

apc.filters = wp-cache-base

This tells APC to ignore this file so instead of caching the runtime, it gets compiled every time it’s called upon.  The performance penalty is negligible for this small file so it’s safe to use this workaround.

Restart PHP-FPM (or PHP-CGI) now.  The blank pages issue should be gone.  

Good luck! 

 




Actions

Information



Leave a comment

You can use these tags : <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

ERROR: si-captcha.php plugin says GD image support not detected in PHP!

Contact your web host and ask them why GD image support is not enabled for PHP.

ERROR: si-captcha.php plugin says imagepng function not detected in PHP!

Contact your web host and ask them why imagepng function is not enabled for PHP.