Can't get PHP to report errors

0 votes
asked Aug 30, 2010 by nathan

I can't see any PHP errors. I have tried every trick I can find to turn error reporting on, but nothing works.

display_errors is on and error_logging is on, but when I view any page with an error, I get a blank page.

/var/log/php.log does not exist.

if I set a local logfile, Nothing gets created.

The file I have been testing with is




any other ideas?

5 Answers

0 votes
answered Aug 30, 2010 by leafo

Have you tried editing the actual ini file as opposed to trying to change it at runtime? You can also try using ini_get('display_errors'); to see if your change took effect. If neither of those work I would say your installation is either faulty or very restricted.

0 votes
answered Aug 30, 2010 by hans

You probably need to set it in .htaccess, httpd.conf or php.ini (depending on your server or hosting company). You most likely have a parse error, which means your script never gets to the point where it can turn on the error reporting.

0 votes
answered Aug 31, 2010 by marc-b
  1. Run phpinfo() as the first thing in the script, before you try any of the ini_set options. If your host has those ini functions disabled/restricted, you'll most likely not ever get to phpinfo.
  2. Does the userID the webserver's running under have write permissions in the directory you're running this script from? It could be failing to open your test log file and kill the script that way.

Once you get some phpinfo() output, you'll be able to see if/where PHP is logging errors. It could be going into the server's general error_log, or some other location entirely.

0 votes
answered Aug 28, 2015 by ehsan-khan

i solved this problem by my hosing website cpanel-> php config ->display error on

0 votes
answered Sep 15, 2017 by faisal

Please try with this below code:

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

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

display_errors = on
Welcome to Q&A, where you can ask questions and receive answers from other members of the community.
Website Online Counter