php error handling

To display all errors you need to:

1. Have these lines in the PHP script you’re calling from the browser (typically index.php):


2.(a) Make sure that this script has no syntax errors


2.(b) Set display_errors = On in your php.ini

Otherwise, it can’t even run those 2 lines!

You can check for syntax errors in your script by running (at the command line):

php -l index.php

If you include the script from another PHP script then it will display syntax errors in the included script. For example:


ini_set('display_errors',1);// Any syntax errors here will result in a blank screen in the browser

include 'my_script.php';


adjfkj // This syntax error will be displayed in the browser