Forum Moderators: coopster

Message Too Old, No Replies

find the error log path programmatically

Is it possible?

         

tata668

6:21 pm on Feb 26, 2007 (gmt 0)

10+ Year Member



I'd like to know, from within a php script, what is the path of the errog_log that would be used by PHP.

This will work but only if "error_log" is set in php.ini:


$path = ini_get('error_log') ;

It doesn't work if "error_log" is commented.

Is there a way to always know the file that would be used?

I want to do this because I need to display the errors on a web page. So I plan to load the content of the error_log and display it.

Thanks

eelixduppy

6:34 pm on Feb 26, 2007 (gmt 0)



Well, if it's not set in php.ini, I believe it is located by default in the web server's log directory, which is
error.log
in the
logs
directory above htdocs with apache.

This is going to be difficult as the default location for this is server specific. There may be a work around.

tata668

6:41 pm on Feb 26, 2007 (gmt 0)

10+ Year Member



I could check "logs/error.log" if nothing is set in php.ini, indeed, but there is always the possibility that "ErrorLog" is set to another value in httpd.conf. So this won't be 100% reliable.

But I may find a solution using this tip... Thanks.