superslurpee
Programmer
- May 15, 2002
- 108
Hi,
I need some clarification regarding error logging. I'm on a shared server and want all errors to be written to a log file instead of the browser. I'm using error_log(string, 3, file) to write to a file and have display_errors off and log_errors on. I have the following questions:
1. File Permissions - I've noticed the file has to exist and have write/execute permissions to write to otherwise nothing happens (file isn't created or nothing is appended). Should I be including a check to see if a log file exists and create/set permissions before calling error_log?
2. Security - Where should this log file be located? Having a file with write/execute permissions in the web root would be dangerous and accessible from the browser. If it should go above the web root, how do I access it?
3. I have seen fopen instead of error_log. I would assume error_log is more appropriate for errors but is it? Is one better?
I just need an effective and secure way of taking all possible errors and logging them instead of sending them to the browser. Everything I read about error logging assumes access to the entire server and makes it seem so simple. Even php.net just says to use "type 3 to send the error to a file". A little explanation about how to do that would be nice!
I would appreciate any comments on what I should know regarding logging errors.
Thank you in advance!
Darth Slurpee
--At last we will reveal ourselves to the SEV employees--
I need some clarification regarding error logging. I'm on a shared server and want all errors to be written to a log file instead of the browser. I'm using error_log(string, 3, file) to write to a file and have display_errors off and log_errors on. I have the following questions:
1. File Permissions - I've noticed the file has to exist and have write/execute permissions to write to otherwise nothing happens (file isn't created or nothing is appended). Should I be including a check to see if a log file exists and create/set permissions before calling error_log?
2. Security - Where should this log file be located? Having a file with write/execute permissions in the web root would be dangerous and accessible from the browser. If it should go above the web root, how do I access it?
3. I have seen fopen instead of error_log. I would assume error_log is more appropriate for errors but is it? Is one better?
I just need an effective and secure way of taking all possible errors and logging them instead of sending them to the browser. Everything I read about error logging assumes access to the entire server and makes it seem so simple. Even php.net just says to use "type 3 to send the error to a file". A little explanation about how to do that would be nice!
I would appreciate any comments on what I should know regarding logging errors.
Thank you in advance!
Darth Slurpee
--At last we will reveal ourselves to the SEV employees--