Force display php errors

Posted by Darwin Biler on December 8, 2012

Server Administrators sometimes disables the php error display settings, so when there is a problem, you cannot see the error message in the web page. For security purposes, its good, but for debuggin tasks, its a nightmare.

The code below will force the display of php errors in your web page

ini_set('display_errors', 1);
ini_set('log_errors', 1);
ini_set('error_log', dirname(__FILE__) . '/error_log.txt');
error_reporting(E_ALL);

Did you find this useful?

I'm always happy to help! You can show your support and appreciation by Buying me a coffee (I love coffee!).