Windows – Can you use a windows enviroment variable in apache conf

apache-2.2httpd.confwindows

Is it possible to include a windows enviroment variable in an httpd.conf?

Ideally I would like to set DocumentRoot to something like %PROGRAMDATA%\MyCompany\MyApp\htdocs.

Background: I'm trying to make a custom apache installer as part of a larger project. I could make installer write an absolute path into httpd.conf, but I'd prefer to keep the conf file portable if possible.

Best Answer

Based on this bug report it would appear that environment variable expansion in configuration files on Windows is a valid feature in Apache. Looks like you can use the same syntax as environment variable expansion that you would for Apache on a *nix OS-- ${variable_name}.

Related Topic