28Mar/090

PHP error reporting

If you've ever experienced a blank white screen after modifying your PHP code, then you should find these two lines of code very useful.

By default error reporting is turned off which most configurations of PHP, however to turn it on is pretty straight forward. In order to turn on PHP error reporting you'll just need to add the following two lines of code at the beginning of your application.

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

  • The first line enables errors, and says that they should be printed to the screen as part of the output.
  • The second line specifies that all errors should be included in the output.

Once you've made the change refresh your page and you should now see some useful error messages which will help you debug the problem.

Filed under: Development No Comments