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.

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

asked Jun 1, 2015 in codeinither by rajesh
0 votes
18 views



Related Hot Questions

2 Answers

0 votes

This always works for me:

ini_set('display_errors',1);
ini_set('display_startup_errors',1);
error_reporting(-1);
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):

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

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

—or—

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:

index.php

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

// Any syntax errors here will result in a blank screen in the browser

include 'my_script.php';

my_script.php

answered Jun 1, 2015 by rajesh

...