httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Philox / Jonathan Salomon <j...@philox.eu>
Subject [users@httpd] environment vars in Apache
Date Wed, 20 Sep 2006 13:24:10 GMT
Hi all!

I have a problem with Apache/2.2.3 (Unix) mod_ssl/2.2.3 OpenSSL/0.9.8b 
PHP/5.1.6 and environment viarables. I would like to pass the bash 
HOSTNAME variable to the apache logfiles. Therefore I have adjusted the 
httpd.conf as follows:

PassEnv HOSTNAME
LogFormat "%{HOSTNAME}e %h %l %u %t \"%r\" %>s %b \"%{Referer}i\" 
\"%{User-Agent}i\"" combined

The problem is however that when starting apache (whether from apachectl 
or httpd binary directly) it does not log HOSTNAME but logs a hyphen 
instead, also on startup it complains that the HOSTNAME was undefined:

$ /usr/local/apache2/bin/httpd -k start
[Wed Sep 20 12:54:46 2006] [warn] PassEnv variable HOSTNAME was undefined

However when I run apache as below then it does work:

HOSTNAME=www1 /usr/local/apache2/bin/httpd -k start

and apache does log the hostname to the logfile like I want it to. The 
(to me) weird thing is that the HOSTNAME var is set in the bash shell 
because when I invoke apache as follows it works as well:

HOSTNAME=$HOSTNAME /usr/local/apache2/bin/httpd -k start

I did have a look at /usr/local/apache2/bin/envvars but it seems that 
that is only called upon by apachectl which invokes httpd and since the 
issue arises with httpd that doesn't seem to be the problem. Can anyone 
tell me where to look?

Thanks!
Jonathan

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Mime
View raw message