500内部服务器错误,如何调试 [英] 500 internal server error, how to debug
问题描述
我的POST请求中出现内部服务器错误.我该如何调试它们?是否可以在php.ini中进行设置?该文件确实很大,并且在那里多次遇到错误"一词.
I have internal server errors on my POST requests. How can I debug them ? Is it something to set up in php.ini ? THe file is really big and the word 'error' is met there many-many times.
推荐答案
您可以使用 error_reporting
:
You can turn on your PHP errors with error_reporting
:
error_reporting(E_ALL);
ini_set('display_errors', 'on');
即使放置了此内容,错误仍然可能不会出现.如果脚本中出现致命错误,则可能导致这种情况.来自 PHP运行时配置:
It's possible that even after putting this, errors still don't show up. This can be caused if there is a fatal error in the script. From PHP Runtime Configuration:
尽管display_errors可以在运行时设置(使用ini_set()),但是如果脚本有致命错误,它将不会有任何影响.这是因为所需的运行时操作未执行.
Although display_errors may be set at runtime (with ini_set()), it won't have any affect if the script has fatal errors. This is because the desired runtime action does not get executed.
您应该在php.ini
文件中设置display_errors = 1
并重新启动服务器.
You should set display_errors = 1
in your php.ini
file and restart the server.
这篇关于500内部服务器错误,如何调试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!