Set environment variable for process spawned by Apache webserver

apache-2.2environment-variables

How can I set an environment variable (not an "Apache environment variable", as described in the Apache HTTP server documentation here, but a plain old operating system environment variable) for processes spawned by Apache HTTP server?

I have a Flask WSGI application for which I would like to have an environment variable set for the user www-data under which the HTTP server runs.

This is basically the same as the question How to set an environment variable for a process spawned by the webserver?, except for Apache HTTP server.

Best Answer

You already mentioned the docs. There it is: http://httpd.apache.org/docs/2.2/mod/mod_env.html

Look for the SetEnv. It is exactly what you requested.