简体   繁体   中英

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. 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.

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 . It took me 45 minutes to track down the misspelled declaration! Why am I suddenly not getting PHP errors??

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. Apache log shows absolutely nothing.

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:

[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. 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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