Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use the setEnv variable in apache?

Tags:

apache

setenv

I need to set my apache environment to 'foobar'

I know I need to set in in my vhost, but what should I type there and where?

like image 948
baklap Avatar asked Sep 03 '10 18:09

baklap


People also ask

What is Setenv in Apache?

SetEnv DirectiveSets an internal environment variable, which is then available to Apache HTTP Server modules, and passed on to CGI scripts and SSI pages.

What is the use of Setenv command?

setenv is a built-in function of the C shell (csh). It is used to define the value of environment variables. If setenv is given no arguments, it displays all environment variables and their values. If only VAR is specified, it sets an environment variable of that name to an empty (null) value.

How do I set environment variables in httpd conf?

The most basic way to set an environment variable in Apache is using the unconditional SetEnv directive. Variables may also be passed from the environment of the shell which started the server using the PassEnv directive.


1 Answers

SetEnv sets a particular variable to some value, so you need something like

SetEnv varname varvalue 

If this is for a specific virtual host, and you have access to the Apache configuration files, this would go inside the <VirtualHost> directive for that virtual host.

If you don't have control of the config files, you'll need to put it in a .htaccess file. But for this to work, SetEnv must be allowed in .htaccess files, which is specified using the AllowOverride directive.

like image 144
Richard Fearn Avatar answered Sep 23 '22 13:09

Richard Fearn