Page 1 of 1

unwanted display of error messages

Posted: Sat Aug 08, 2009 9:56 am
by mottwsc
I'm forcing an error by purposely leaving out an include file that has db login information in it. When I render the php page, and get to the connection statement

Code: Select all

$cxn = mysqli_connect($host,$user,$password,$dbname) 
            or die ("Couldn't connect to server.".mysqli_error($cxn));
I get the message 'Couldn't connect to server.'

That makes sense. The problem is that I am trying to not have this error display, but instead write the error to a log file that I've specified (which is set up in another directory for security reasons). I have modified the php.ini file so that:
error_reporting = E_ALL
display_errors = Off
log_errors = On
error_log = c:/php/log/phplog.txt

Unfortunately, I still see the error in the browser and it is not written to the log file.

What still needs to be adjusted so that the error is not shown in the browser but is instead written to the log file?

Thanks!

Re: unwanted display of error messages

Posted: Sat Aug 08, 2009 11:21 am
by mottwsc
I tried that specific code, and I still get the generic error message on the screen (not the one in the code), and I don't see anything written to the log file.

Are there other parameters in the ini file that might not be set to allow this to happen?

Re: unwanted display of error messages

Posted: Sat Aug 08, 2009 11:32 am
by redmonkey
Have you tried enclosing the path to the logfile in quotes? I assume you've done the usual sanity checks in that the PHP process has the appropriate permission to write to the file?

Re: unwanted display of error messages

Posted: Sat Aug 08, 2009 11:37 am
by Eran
did you restart your webserver after making the configuration changes?

SOLVED Re: unwanted display of error messages

Posted: Sat Aug 08, 2009 12:40 pm
by mottwsc
There also was a permissions issue. I was able to get it to work.

Thanks to all.