简体   繁体   English

为什么Apache会给我Server Error 500而不是PHP错误,以前工作正常?

[英]Why is Apache giving me Server Error 500 instead of PHP errors, previously working fine?

I've been trucking along for the past 4 weeks with my MAMP server updated and running well. 在过去的4周中,我一直在努力进行更新,并更新我的MAMP服务器并使其运行良好。 Been coding PHP files, and when I make a mistake or don't understand what I'm doing, I get a nice little PHP error on the page in place of the called file. 一直在对PHP文件进行编码,当我犯了一个错误或不了解自己在做什么时,页面上会出现一个很好的PHP错误,代替了被调用的文件。

It's helping me figure out what I'm doing wrong. 它可以帮助我弄清楚我在做什么错。

Today, I sit down to start working, and suddenly I'm getting Server Error 500 . 今天,我坐下来开始工作,突然间我收到了Server Error 500 It took me 45 minutes to track down the misspelled declaration! 我花了45分钟才能找到拼写错误的声明! Why am I suddenly not getting PHP errors?? 为什么我突然没有得到PHP错误?

Nothing has changed that I know of. 我所知道的没有任何改变。 I haven't updated any apps in over a week. 我有一个星期没有更新任何应用程式。 The PHP error log is showing the T-String errors no problem. PHP错误日志显示T字符串错误没问题。 Apache log shows absolutely nothing. Apache日志绝对不显示任何内容。

Again, as far as I know, no configuration has changed. 再次,据我所知, 没有任何配置已更改。

MAMP ver. 3.5
Apache ver. 2.4.16 (Unix)
PHP ver. 5.6.10

php_error.log: php_error.log:

[26-Jan-2016 03:59:26 UTC] PHP Parse error:  syntax error, unexpected end of file in /Applications/MAMP/htdocs/includes/pages.php on line 43

error reporting declaration (hasn't changed!) 错误报告声明(未更改!)

error_reporting( E_CORE_ERROR | E_CORE_WARNING | E_COMPILE_ERROR | E_ERROR | E_WARNING | E_PARSE | E_USER_ERROR | E_USER_WARNING | E_RECOVERABLE_ERROR );

Open your php.ini file to check whether your error reporting has turn off. 打开您的php.ini文件,检查您的错误报告是否已关闭。 If this is the case then enable run time error-reporting by adding this two line in the top of your file 如果是这种情况,请通过在文件顶部添加这两行来启用运行时错误报告

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

You should only do this for debugging purpose and don't forget to remove this in production server. 您仅应将此目的用于调试目的,并且不要忘记在生产服务器中将其删除。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM