【发布时间】:2014-01-22 13:08:06
【问题描述】:
编辑:
我已完成重复答案中建议的所有操作,但没有任何效果。这是我的 PHP 信息:
这是 nginx 和 stderr 消息的特定问题,而不是一般的“我如何打开 PHP 错误报告”问题。
在开发过程中,每当我在 PHP 中创建一个带有拼写错误或只是我的编程错误的致命错误时,我的浏览器中就会出现空白页;)。不得不查看原始 nginx 错误日志文件以查看致命错误并找到它们所在的行号,这对我来说非常烦人。我似乎找不到如何让 nginx 在浏览器中显示 PHP 致命错误。这是我的 nginx 配置的相关部分:
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;
}
这是一个错误示例,它显示在我的错误日志中,然后导致浏览器页面空白:
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"
这是我的 PHP-FPM 配置文件:
还有我的 PHP-FPM 池配置:
还有我的 PHP-FPM php.ini:
如果有人能阐明我可以做些什么来让这些错误出现,我会很高兴的!
【问题讨论】:
标签: nginx development-environment php