My PHP-CGI started serving blank pages for no apparent reason until I restarted the process.
I want to know why.
Unfortunately the "production" configuration file of PHP has no error_log by default. My Nginx error log also displayed no errors relating to PHP. This is probably a hopeless case, but I am asking just in case.
Here is my setup
- Nginx 0.8.2
- PHP 5.2.6-3ubuntu4.1 with Suhosin-Patch 0.9.6.2 (cli) (built: Apr 23 2009 14:37:14)
- PHP APC 3.0.19-2
- spawn-fcgi v1.6.2 (ipv6) - fastcgi wrapper from lighttpd
Any ideas what might have caused the error?
Update
I think I've isolated the problem. I've been using Monit to automatically restart PHP whenever it started blanking. My PHP error logs are blank.
But I figured out that if I disabled a Wordpress plugin called WP-SuperCache, my PHP stopped being reset every ~10 hours. So far my PHP has been running for 3 days straight. Does anyone have any suggestions about this?
Supercache generates full cached versions of pages, as well as doing some other internal caching, it's possible there's some sort of timing issue in high-load situations. I'd check your cache folder to make sure it doesn't contain blank files. If it does, you probably have a file locking issue. Solving such an issue may be tricky, and will probably require you to open a bug ticket, as it's likely a problem with the code itself.
have you tried actually stopping the fcgi service and starting it again as opposed to restarting it. i have had similar weird things happen while restarting fcgi
Not an answer, but suggestion - replace spawn-fcgi with php-fpm it's more customizable.
PS. maybe you have special 50x error page redirect in nginx.conf
UPD: today i've ran into similar problem when nginx+php started to serve blank pages. My research showed that it sended blank page whatever php threw an exception. May be it's some kind of php.ini directive to serve blank instead of an error. I should examine logs and etc... wip.
UPD2: Look at your php.ini there is 2 parameters in it that you need to change in order to see php errors:
Check the response status of your requests if it happens again (eg. curl -i) and if the status isn't 200, check your error pages (specifically the one(s) for the error number shown) and ensure they aren't set to redirect in a way which might cause an infinite loop.
If the response status is 200, check whether there's any text in the response other than the HTTP headers.
This is a common problem, best thing you can do is nightly restart your spawn-fcgi and watch your error logs. A small python logwatch program that will restart your php can be found here.
http://hostingfu.com/article/keeping-your-php-fastcgi-processes-alive
The "spontaneously happened overnight" clause sounds interesting... is it possible your host started adding extra status headers to all traffic? If so, you might be seeing this bug:
Joomla! php, FastCGI, blank page and duplicate header 'Status'