Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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?

share|improve this question

6 Answers 6

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.

share|improve this answer

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:

error_reporting = E_ALL & ~E_NOTICE
display_errors = On
share|improve this answer

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

share|improve this answer
    
The problem didn't come from restarting. It just spontaneously happened overnight when I got a bunch of visitors from a link dump called Reddit. –  Unknown Jun 25 '09 at 22:35

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'

share|improve this answer
    
I don't think so. I control the host. –  Unknown Jul 12 '09 at 19:44

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.

share|improve this answer
    
I suppose I should've done that, but I already restarted PHP so people could view the page. I didn't see any errors in my server log. –  Unknown Jul 12 '09 at 19:45

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

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.