2

EDIT:

I have done everything suggested in the duplicate answers and nothing works. Here is my PHP info:

enter image description here

This is a specific issue with nginx and stderr messages and is not a generic "how do I turn on PHP error reporting" issue.


While developing I'm getting blank pages in my browser whenever I create a fatal error in PHP with a typo or just my bad programming ;). It's super annoying for me to have to view the raw nginx error log file to see the fatal errors and find the line numbers where they are. I can't seem to find how to make nginx display PHP fatal errors in the browser. Here is the relevant part of my nginx config:

location @fpm {
    fastcgi_pass unix:/var/run/php5-fpm.sock;
    fastcgi_index index.php;
    include fastcgi_params;
    fastcgi_param SCRIPT_NAME index.php;
    fastcgi_param SCRIPT_FILENAME $document_root/index.php;
    fastcgi_param PATH_INFO $path_info;
}

Here's an example error that shows up in my error log and then results in a blank browser page:

2014/01/04 14:53:52 [error] 20082#0: *403 FastCGI sent in stderr:
"PHP message: PHP Fatal error:  Cannot redeclare class ClassName in FilePath on line 356"
while reading response header from upstream, client: 192.168.1.10,
server: servername, request: "GET URLPATH HTTP/1.1",
upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "host",
referrer: "referer"

Here is my PHP-FPM conf:

http://pastebin.com/QkCTbBYj

And my PHP-FPM pool conf:

http://pastebin.com/TZfZ8d7G

And my PHP-FPM php.ini:

http://pastebin.com/RsXRxduf

I would love if anyone could shed some light on what I could do to get these errors to show up!

Kirk Ouimet
  • 27,280
  • 43
  • 127
  • 177
  • possible duplicate of [How do I enable error reporting in PHP?](http://stackoverflow.com/questions/6575482/how-do-i-enable-error-reporting-in-php) – PeeHaa Jan 04 '14 at 22:59
  • possible duplicate of [How to get useful error messages in PHP?](http://stackoverflow.com/questions/845021/how-to-get-useful-error-messages-in-php) – dev-null-dweller Jan 04 '14 at 23:09

1 Answers1

0

try setting catch_workers_output to yes in pool config:

; Redirect worker stdout and stderr into main error log. If not set, stdout and ; stderr will be redirected to /dev/null according to FastCGI specs. ; Note: on highloaded environement, this can cause some delay in the page ; process time (several ms). ; Default Value: no catch_workers_output = yes

if that doesn't work you might have this bug:

https://bugs.php.net/bug.php?id=61045

troseman
  • 1,842
  • 20
  • 19