3

I want to set an env variable that has the DOC_ROOT info but nothing

SetEnv PROJECT_BASE %{ENV:DOC_ROOT}
SetEnv LAYOUT_HOME  %{ENV:PROJECT_BASE}"/html/app/wordpress/"

and then be able to access LAYOUT_HOME in php

How can I do this? The above is not working for me...

The problem is the base path is different on diff environments =/

qodeninja
  • 2,803

2 Answers2

5

SetEnv is a directive for mod_env, and mod_env doesn't support %{ENV:var} -- only mod_rewrite does this. Don't forget that apache is modular, and modules define their own directives. You can do this with mod_rewrite like this:

 RewriteRule .* -  [E=PROJECT_BASE:%{ENV:DOC_ROOT}]
  ... etc

I must ask, what are you really trying to do? There must be a better way. I can't think of any reason to define your LAYOUT_HOME variable in apache instead of php.

beans
  • 1,700
0

Use getenv, doc here.

It will get any Environment Variable, just use it to get the one you set on Apache.

coredump
  • 12,921