Errors not being written to log file or displayed

I recently began teaching myself PHP to make my web site easier to maintain. I have installed Apache 2.2, PHP 5, and MySQL 5.5 on a WinXP Sp3 box. I followed the recommended configurations for each server and verified my settings against several ‘how to’ posts found from Google searches because truth be told I wouldn’t know right from left. My issue is that I am trying to use the error reporting and logging in PHP and/or Apache to help me debug my code (this is of course based on the assumption that if the actual result and the desired result dont match I probably did something wrong) however I cannot coerce PHP to either display the errors or put them into a log file anywhere ( I have searched Windows, Apache, PHP, and “/error_log/log_file.txt” which I created). I am also assuming that if I run a piece of code once and get a page of result like cool background and a table of pictures then change something in the parent code and on the next page refresh get a blank white page at least one error has occured and should be recorded somewhere.

Here are my current PHP error settings :

error_reporting = E_ALL & E_STRICT
display_errors = “stdout”
display_errors = On
display_startup_errors = On
log_errors =On
log_errors_max_len = 1024 (default)
ignore_repeated_errors = Off (default)
ignore_repeated_source = Off (default)
report_memleaks = On (default)
;report_zend_debug = 0 (default)
track_errors = Off (default)
;xmlrpc_error_number = 0 (default)
html_errors = On
docref_root = “/phpmanual/” (default)
docref_ext = .html (default)
;error_prepend_string = “” (default)
;error_append_string = “” (default)
error_log = /htdocs/error_log
; Log errors to syslog (Event Log on NT, not valid in Windows 95).
error_log = Off (default)

Any pointers or redirects would be welcome. Thank you in advance for your assistance.

ikan

What you should do is first make sure your php.ini file is updating (that you are using the right one, and the httpd service is reset after making changes)

Create a PHP file on your server, I usually call it pinfo.php and paste this in it

[php]<?php phpinfo(); ?>[/php]

Then load this page and verify that your php.ini settings are correct.

I ran “phpinfo()”. It completed successfully and printed out a long list of information that, in reality, means not much to me. I did find one line of interest though, it reads "Directive:error_reporting, Local value: 0, Master Value: 0. Assuming I am understanding what I am reading the “error_reporting” is set to not report errors which is in opposition to the setting in the “.ini” file which reads: " error_reporting = E_ALL & E_STRICT ". Thinking that it was set in error I again consulted the PHP Manual for a better understanding and found the setting to be correct for the level of reporting I seek. I then checked further to be sure both PHP and the “php.ini” are available to Windows and found that the path is set correctly in the “Environment Variables” which leaves me scratching my head in wonder. If the settings are correct why do errors not get displayed and or logged? Why does PHP not create the error log file either on the path I have specified or it’s own default path or log errors in the Apache error log. I know errors are being commited. I have purposely created them to test the logging and reporting with no result. Is there a different setting in “php.ini” that needs to be corrected? If so please point it out to me. My current settings are listed in my first post, I have made no changes to them under the assumption that they are correct. Of course I am questioing that assumption based on the fact that no error reporting is being done but can find no reason for the condition to exist.

ikan

I think the value you want for error_reporting is E_ALL | E_STRICT (using | instead of &)

Otherwise I’m not sure what the problem could be. These are the only settings you need to verify:

error_reporting = E_ALL | E_STRICT
display_errors = On
log_errors = On
error_log = /path/to/php_errors.log

woohoo!!!

I have no idea which one it was but one of the settings you suggested made the differance. Not that I am really glad to have a whole page of errors to work through but I am glad to at least see some feedback to help me learn what I am doing right and what wrong. Thank you m@tt

Now its time to start some real work

ikan

Sponsor our Newsletter | Privacy Policy | Terms of Service