Organizational Research By

Surprising Reserch Topic

get PHP Errors to display?

I have checked my PHP ini file and display errors is set and also error reporting is E_ALL. I have restarted my apache web server. I have even put these lines at the top of my script and it doesn't even catch simple parse errors. For example, I declare variables with a "$" and I don't close statements ";". But all my scripts show a blank page on these errors, but i want to actually see the errors in my browser output.

ini_set('display_errors', 1);

asked Jun 1, 2015 in codeinither by rajesh
0 votes

Related Hot Questions

2 Answers

0 votes

This always works for me:

answered Jun 1, 2015 by rajesh
0 votes

To display all errors you need to:

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

ini_set('display_errors', 1);

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';


answered Jun 1, 2015 by rajesh