How to set an environment variable in Apache that is passed to CGI scripts

Apache has some default set environmental variables that you can use, but when these don’t suffice we can set our own environment variables within our virtual host configuration. Some default environmental variables that you can use are:

SERVER_PORT, SERVER_PROTOCOL, SERVER_ADMIN, DOCUMENT_ROOT, HTTP_ACCEPT and so on. Now, let’s set our own variable within our virtual host configuration:

<VirtualHost host>

SetEnv THISISANENV yes

...

</VirtualHost>

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s