10

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

<?php
ini_set('display_errors',1);
error_reporting(E_ALL|E_STRICT);
ini_set('error_log','script_errors.log');
ini_set('log_errors','On');


$a=

phpinfo();
?>

any other ideas?

4 Answers 4

3

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.

Sign up to request clarification or add additional context in comments.

2 Comments

I tried your code and it works on the command line, I wonder if you have a setup that refuses to show output of phpinfo() (for security reasons) and you are seeing a valid, though still blank, page. See what 'disable_functions' is set to, if you can.
@Nathan did you select this answer b/c it was helpful or for different reasons? I am having the same problem and as is I don't find it too helpful. Hans, perhaps if you mentioned how to check to see if one has a parse error.
1

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.

1 Comment

I have tried setting it there, and reported it as on, but there was no effect.
0
  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.

Comments

0

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

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.