https://issues.apache.org/bugzilla/show_bug.cgi?id=49032
Summary: Environment variable expansion in configuration file
fails in Windows
Product: Apache httpd-2
Version: 2.2.15
Platform: PC
OS/Version: Windows XP
Status: NEW
Severity: normal
Priority: P2
Component: Runtime Config
AssignedTo: [email protected]
ReportedBy: [email protected]
When using environment variable expansion in Apache configuration files when
running Apache 2.2.x in Windows, Apache fails to start.
Steps to reproduce:
1) For example, create an empty file "x.conf" and place in C:\
2) Set an environment variable (in control panel -> System -> advanced ->
environment variables) called APACHETEST, with the value "C:\"
3) Add the following line to httpd.conf:
Include ${APACHETEST}/x.conf
4) Restart Apache
Actual results:
No error appears on the command line when starting Apache, but the Apache
service fails to load. The error is only visible in the Windows Event Viewer,
accessible from Control Panel -> Administrative Tools -> Computer Management ->
System Tools -> Event Viewer -> Application, and it fails with the following
error:
The Apache service named reported the following error:
>>> httpd.exe: Syntax error on line 55 of C:/Program Files/Apache Software
>>> Foundation/Apache2.2/conf/httpd.conf: Could not open configuration file
>>> C:/Program Files/Apache Software Foundation/Apache2.2/${APACHETEST}/x.conf:
>>> The system cannot find the path specified .
Expected results:
The Apache service starts normally.
We have reproduced this bug in both 2.2.3 and 2.2.15 on Windows XP. Note that
the bug does NOT occur on Linux or OS X.
IMPORTANT NOTE:
Note that the error is only visible in Event Viewer. Interestingly, if you fail
to set the environment variable or set it to the wrong location (for example
set APACHETEST=foobar) then Apache will fail to start but will report the error
to the console. It appears that when Apache first starts, when it parses the
configuration file it DOES to environment variable substitution correctly, and
will report errors correctly to the console. However, in some subsequent phase
(while actually acting on the configuration directives, presumably),
environment variable substitution does NOT work correctly, but instead of
reporting the error to the console, it reports it "silently" to Event Viewer
and exits. This was a very frustrating bug to track down!
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]