PHP FPM针对所有PHP错误返回HTTP 500 [英] PHP FPM returns HTTP 500 for all PHP errors
问题描述
我正在用PHP-FPM运行Nginx.我的用于处理php文件的nginx配置看起来像这样:
I am running nginx with PHP-FPM. My nginx configuration for handling php files looks like this:
location ~ \.php$ {
set $php_root /home/me/www;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $php_root$fastcgi_script_name;
include /etc/nginx/fastcgi_params;
}
现在,我有一个简单的php文件,如下所示:
Now, I have a simple php file like this:
<?php
ech "asd"
asd""
?>
是,有明显错误.当我尝试访问php文件时,没有找到语法错误,而是始终收到HTTP 500 Internal Server Error.我尝试使用error_reporting(-1);
,但始终返回HTTP500.如何获取PHP以打印确切的错误呢?返回通用HTTP 500的方法?
Yes, with an obvious error. When I try accessing the php file, instead of tracing a syntax error, I always get a HTTP 500 Internal Server Error.I tried using error_reporting(-1);
but still it always returns HTTP 500. How do I get PHP to print the exact error instead of returning a generic HTTP 500?
推荐答案
尝试在您的php.ini
中找到以下行:
Try to find the following line in your php.ini
:
display_errors = Off
然后戴上
这篇关于PHP FPM针对所有PHP错误返回HTTP 500的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!