Page 1 of 1

show hostname in php_error.log ?

Posted: Mon Feb 06, 2006 8:18 am
by rontober
for a server that runs multiple domains, i was just wondering if it is possible to display the hostname that generates the error in php_error.log?

i've looked around but cant find it so far, it would be a very handy functionality. Many thanks in advance.

Oh and that's PHP4.3 with Apache2

Posted: Mon Feb 06, 2006 9:31 am
by feyd
check out the $_SERVER variables.. there' s a few in there that may be of interest.

Posted: Mon Feb 06, 2006 9:52 am
by rontober
$_SERVER['SERVER_NAME']

that looks like (something similar to) what i want.

Can i simply include this in php.ini in some way, or do i need to rewrite the error handler for each php file?

Posted: Mon Feb 06, 2006 10:29 am
by feyd
oops, I misread your post.

Apache has internal variables set for SERVER_NAME when dealing with logs:

http://httpd.apache.org/docs/1.3/mod/mo ... ml#formats