Monday, September 2, 2013

Display all php errors and warnings

I am annoyed why my php script doesn't show errors and warnings like it did before. It seems my server admin has default config set not to show the errors and warnings.

Every time I was debugging the code I found myself searching around for the little chunk of code to display all PHP errors and warnings. So, I put in the my post so it was always nearby when I needed.

If you wish to see all the PHP errors and warnings in your script, include the following bit of code to override the php default config setting.

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

No comments:

Post a Comment