Tuesday, September 25, 2018

How do I get PHP errors to display?



I have checked my PHP init file (php.ini) and display_errors is set and also error reporting is E_ALL. I have restarted my Apache webserver.



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



What is left to do?


Answer



This always works for me:



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



However, this doesn't make PHP to show parse errors - the only way to show those errors is to modify your php.ini with this line:



display_errors = on


(if you don't have access to php.ini, then putting this line in .htaccess might work too):



php_flag display_errors 1

No comments:

Post a Comment

plot explanation - Why did Peaches' mom hang on the tree? - Movies & TV

In the middle of the movie Ice Age: Continental Drift Peaches' mom asked Peaches to go to sleep. Then, she hung on the tree. This parti...