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

When accessing some PHP scripts on my website, I'm getting the dreaded 500 error message. I'd like to know what's wrong to fix it, but Nginx isn't logging any PHP errors in the log file I have specified. This is my server block:

server {
    listen 80;
    server_name localhost;
    access_log /home/whitey/sites/localhost/logs/access.log;
    error_log /home/whitey/sites/localhost/logs/error.log error;
    root /home/whitey/sites/localhost/htdocs;
    index index.html index.php /index.php;

    location / { 


    location ~ \.php$ {
        fastcgi_pass unix:/tmp/phpfpm.sock;
        fastcgi_param SCRIPT_FILENAME  $document_root$fastcgi_script_name;
        include fastcgi_params;

    location ~* \.(?:ico|css|js|gif|jpe?g|png)$ {
        expires max;

Note that some PHP scripts work fine, and others don't. So there isn't a global problem with PHP, there's just something in these scripts that's causing Nginx to throw the 500 error.

How can I get to the bottom of this? The only thing in error.log is an error about favicon.ico not being found.

share|improve this question
Could you append a part of the error log? –  Christopher Perrin Aug 13 '12 at 18:41
This is the entire error log: pastebin.com/re6AwNyL –  James Linton Aug 13 '12 at 18:44
This is indeed not very helpful :-/ –  Christopher Perrin Aug 13 '12 at 18:47

3 Answers 3

up vote 0 down vote accepted

You have to add the following to your php-fpm pool configurations:

catch_workers_output = 1

You have to add this line to each defined pool!

share|improve this answer

php-fpm throws everything in /var/log/php5-fpm.log or similar.

share|improve this answer
That log just shows this: [13-Aug-2012 20:15:54] NOTICE: fpm is running, pid 10599 [13-Aug-2012 20:15:54] NOTICE: ready to handle connections [13-Aug-2012 20:18:37] NOTICE: Finishing ... [13-Aug-2012 20:18:37] NOTICE: exiting, bye-bye! [13-Aug-2012 20:18:39] NOTICE: configuration file /etc/php5/fpm/php-fpm.conf test is successful –  James Linton Aug 13 '12 at 18:39
Try to set `error_log to something. As php-fpm with nginx doesn't work as it works with apache2. –  erickzetta Aug 13 '12 at 18:41
The PHP-FPM log is just about errors of PHP-FPM. You can enable PHP logging seperately in your php.ini –  Christopher Perrin Aug 13 '12 at 18:41
Or check stackoverflow.com/questions/8677493/… –  erickzetta Aug 13 '12 at 18:43

Look in your nginx.conf for an error_log definition. Maybe nginx writes something in this error log.

You might also enable logging to file on PHP.

share|improve this answer
I looked in the file that error_log is set to, and it's empty. No errors at all. –  James Linton Aug 13 '12 at 18:39

Your Answer


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.