Stack trying to migrate a configuration from Linux to Windows Apache 2.2 (via WAMP)
We are trying to set an ENV Apache variable to be used as DocumentRoot and rest of directives thereafter so we can use the same set of confs on server and local working copies of developers.
In Debian Linux Apache we have an envvars file that is loaded with "EXPORT" directives. This does not work on Windows but
Setenv ROOT_TO_FILES "C:/wamp/www/test"
Seems to work as displayed by a phpinfo()
But when we use it inside a DocumentRoot directive of an vhost:
DocumentRoot ${ROOT_TO_FILES}
Apache looks for that literal text under its own root.
This is the way we use it in Linux but we've also tried the syntax of env=ROOT_TO_FILES
The apache doc seems clear about how to "define" but not how to use.
Also I see Apache 2.4 includes a new "Define" directive that seems to do exactly this which makes me think that it might not possible in previous versions.
Any samples of use under Windows Apache would be appreciated.
Answer
Apache's SetEnv
directive just defines a variable that PHP or Perl scripts can use, for example they show up in PHP's $_SERVER[]
global array.
SetEnv
, nor it's cousins, have have anything to do with use of variables in Apache directives.
http://httpd.apache.org/docs/current/mod/mod_env.html#setenv
DocumentRoot
usually needs a literal string...
What you want to do is use mod_macro (included in Apache 2.4.5 / *before that, you can find it as an extra module to download)...
http://httpd.apache.org/docs/current/mod/mod_macro.html
*For Apache 2.2, search Google for mod_macro Apache 2.2 VC9. TS/Thread-safe is for mod_php, NTS/Non-Thread-Safe is for PHP-FCGI.
No comments:
Post a Comment