Thursday, April 7, 2016

Internal Server Error 500 - empty log file - error_reporting silently disabled!

Here's a recent problem I've encountered:

WP installation

WP_DEBUG enabled

display_errors and error_reporting and log_errors all enabled in php.ini and checked with phpinfo()

post.php generates Internal Server Error 500 if a single checkbox selected when "Publish post" is clicked

PHP/Apache error logs and WP's debug.log say nothing about the error


After pinpointing the exact line which causes the error, I've obtained error information by simply adding these two lines after the error generating line:

ini_set("display_errors",1);
error_reporting("E_ALL");

[problematic line]

die();

This immediately printed out the actual error and we're good to go!

So, the moral of this story:

Silently disabling error_reporting in WP or any other PHP code is a danger in disguise. Always bear in mind, that there's a possibility that someone turned of the error reporting inside a plugin or something. Very dangerous habit.

No comments:

Post a Comment

Ubuntu 12.04, 14.04, 16.04 - auto start an app or script before login

To run a command or application at startup, even before the user has logged in, you can use this file: /etc/rc.local The commands entered...