我怎样才能使PHP显示错误,而不是给我500内部服务器错误 [英] How can I make PHP display the error instead of giving me 500 Internal Server Error

查看:146
本文介绍了我怎样才能使PHP显示错误,而不是给我500内部服务器错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是从来没有过。通常它显示错误,但现在它只是给了我一个500内部服务器错误。当然之前,当它显示错误,这是不同的服务器。现在,我是一个新的服务器(我有充分的根,所以如果我需要在php.ini中配置的某个地方,我可以。)或者与Apache也许它的东西吗?

This has never happened before. Usually it displays the error, but now it just gives me a 500 internal server error. Of course before, when it displayed the error, it was different servers. Now I'm on a new server (I have full root, so if I need to configure it somewhere in the php.ini, I can.) Or perhaps its something with Apache?

我已经忍受了它,只需将文件传输到我的其他服务器和运行在那里查找错误,但是这变得过于繁琐。有没有办法来解决这个问题?

I've been putting up with it by just transferring the file to my other server and running it there to find the error, but that's become too tedious. Is there a way to fix this?

推荐答案

检查的error_reporting 的display_errors 和<在你的的php.ini 文件code> display_startup_errors 设置。他们应该被设置为 E_ALL 开启分别为(虽然你不应该使用的display_errors 在生产服务器上,因此,禁用该功能,使用 log_errors 而不是如果/当你部署)。您还可以更改这些设置(除 display_startup_errors )在你的脚本设置它们在运行时(虽然你可能无法捕获所有的错误这种方式)的开始:

Check the error_reporting, display_errors and display_startup_errors settings in your php.ini file. They should be set to E_ALL and "On" respectively (though you should not use display_errors on a production server, so disable this and use log_errors instead if/when you deploy it). You can also change these settings (except display_startup_errors) at the very beginning of your script to set them at runtime (though you may not catch all errors this way):

error_reporting(E_ALL);
ini_set('display_errors', 'On');

在此之后,重新启动服务器

After that, restart server.

这篇关于我怎样才能使PHP显示错误,而不是给我500内部服务器错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆