12 January 2012

Display PHP errors on web page

So you don't have to troll logs when your web page doesn't display what is expected, copy and paste this to the top of your PHP code.

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



You will probably want to remove it once in production.

No comments:

Post a Comment