1. Home
  2. Computing & Technology
  3. PHP / MySQL

PHP Error Reporting
Turning on Error Reporting in PHP

By Angela Bradley, About.com

If you are running into a white page or some other PHP error, but you have no clue what is wrong, you should consider turning on PHP error reporting. This will give you some indication of where or what the problem is. This is a good first step to solving your problem. Here is how to turn on PHP errors:

To display error messages caused by your PHP script you can include these lines of code:

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

Another way to do it is to edit your php.ini file and include this option:

error_reporting = E_ALL

To turn error reporting off for a single document, include this line:

error_reporting(0);

Read more in depth about different types of error reporting available [view]

Help Out! Have a better way... share your code here... or view other's suggestions!

More PHP / MySQL Quick Tips
Explore PHP / MySQL
About.com Special Features

Stay connected and entertained with reviews on tips on the latest HDTVs, cellphones and more. More >

Easy ways to connect two computers for networking purposes. More >

  1. Home
  2. Computing & Technology
  3. PHP / MySQL
  4. Troubleshooting
  5. PHP Error Reporting - Turn on PHP Error Reporting

©2009 About.com, a part of The New York Times Company.

All rights reserved.