How to Enable PHP Errors - Display PHP Errors

If your like me and you need to see the errors your script is spitting out then you found the right web page. Instead of editing the php.ini file this little tid bit of code will temporary show errors just for that page. Copy and paste this code to the top of your script and test the page out.

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


If you want to log the errors too, copy and paste this instead of the above.


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

Post a Comment

0 Comments