Skip Navigation
Madison, Wisconsin
Powderkeg Web Design
December 27, 2013

PHP, Error Reporting, and You

PHP, Error Reporting, and You

When developing in PHP, nothing is more frustrating than running your script and having nothing but a white screen come up. Your 73 lines of code that should echo out beautiful information were not meant to be suppressed with something that gives no indication of what could have gone wrong.

A quick way to enable error reporting in PHP is to put the following at the top of your script:


┬áThis will output any errors or warnings that your code generates and usually what line number of your php file the error occurs instead of just showing you nothing. Now you will know when you’ve forgotten a semi colon or defined a global variable twice.

To remove error reporting, you would want to remove the lines you’ve added. If you don’t have access to the code that allows error reporting but you still want to remove it, you can alternatively add this to the top of your script:


It is important that you do not use the above code to ignore errors and warnings. Rather, you should use it in a production environment where you do not want potential malicious users to decipher sensitive information about your script. I always have error reporting on in my development environment so that I never push out erroneous code.

Further Reading: PHP error_reporting

Nick Kalscheur

Nick Kalscheur

Lead Developer