You are viewing a plain text version of this content. The canonical link for it is here.
Posted to bugs@httpd.apache.org by bu...@apache.org on 2003/01/31 23:42:39 UTC
DO NOT REPLY [Bug 16657] New: -
SetEnv doesn't seem to work inside
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=16657>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND
INSERTED IN THE BUG DATABASE.
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=16657
SetEnv doesn't seem to work inside <Files>
Summary: SetEnv doesn't seem to work inside <Files>
Product: Apache httpd-2.0
Version: 2.0.44
Platform: PC
OS/Version: Linux
Status: NEW
Severity: Minor
Priority: Other
Component: mod_cgi
AssignedTo: bugs@httpd.apache.org
ReportedBy: jhmark@xenops.com
When I put a SetEnv directive inside a <Files> section which identifies a CGI
script, the environment variable is not set when the script is run.
If I move the SetEnv into a <Directory> section for the directory the script is
in, then it works as expected.
Example:
Create directories htdocs/dir1, htdocs/dir2.
Copy test.sh (see below) into htdocs/dir1 and htdocs/dir2, make it executable.
Put example text into your httpd.conf (see below).
Go to http://localhost/test1 ... note that the value of FOO is shown as empty.
Go to http://localhost/test2 ... note that the correct value is shown.
-------------------- here is test.sh
#!/bin/sh
echo Content-type: text/plain
echo
echo value of FOO environment variable is: $FOO
-------------------- here is what to put in httpd.conf
ScriptAlias /test1 /YOURPATH/htdocs/dir1/test.sh
ScriptAlias /test2 /YOURPATH/htdocs/dir2/test.sh
<Files /YOURPATH/htdocs/dir1/test.sh>
Options ExecCGI
SetEnv FOO value_of_foo
</Files>
<Files /YOURPATH/htdocs/dir2/test.sh>
Options ExecCGI
</Files>
<Directory /YOURPATH/htdocs/dir2/>
SetEnv FOO value_of_foo
</Directory>
---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org