| Author |  | 
| abcd 
 
 
 Joined: 06 Aug 2015
 Posts: 1
 Location: India
 
 | 
|  Posted: Mon 10 Aug '15 13:24    Post subject: Issue in passing environmental variables in  Apache 2.4 |   |  
| 
 |  
| I have installed Apache2.4 version but i am not able to pass the environment variables to my application which was working fine in Apache version 1.3.9 , i have googled a lot and after many trials its still not working. 
 The module mod_env.c is loaded and the syntax is
 PassEnv BUILD_HOST
 This env variable is passed through the cgi script which is called by my application.
 
 When i am starting the apache its throwing error:
 
 [Thu Aug 06 14:40:13.740194 2015] [env:warn] [pid 4864:tid 288] AH01506: PassEnv
 variable BUILD_HOST was undefined
 
 Somebody please help!!
 |  | 
| Back to top |  | 
| jraute 
 
  
 Joined: 13 Sep 2013
 Posts: 188
 Location: Rheinland, Germany
 
 | 
|  Posted: Mon 10 Aug '15 14:15    Post subject: Re: Issue in passing environmental variables in  Apache 2.4 |   |  
| 
 |  
| Hello abcd, 
 it's not throwing an error it's just a warning.
 Besides this if you define a variable with PassEnv then you have to set something to fill it.
 That is the missing part at the start.
 |  | 
| Back to top |  | 
| glsmith Moderator
 
  
 Joined: 16 Oct 2007
 Posts: 2268
 Location: Sun Diego, USA
 
 | 
|  Posted: Mon 10 Aug '15 22:06    Post subject: |   |  
| 
 |  
| Do I see confusion between PassEnv (the variable has to already exist in the OS) and SetEnv where you create the variable and give it value? |  | 
| Back to top |  | 
| jraute 
 
  
 Joined: 13 Sep 2013
 Posts: 188
 Location: Rheinland, Germany
 
 | 
|  Posted: Wed 12 Aug '15 8:32    Post subject: |   |  
| 
 |  
|  	  | glsmith wrote: |  	  | Do I see confusion between PassEnv (the variable has to already exist in the OS) and SetEnv where you create the variable and give it value? | 
 
 Not a confusion, but a misunderstanding.
   You are right.
 Anyway what would be the solution?
 |  | 
| Back to top |  | 
| glsmith Moderator
 
  
 Joined: 16 Oct 2007
 Posts: 2268
 Location: Sun Diego, USA
 
 | 
|  Posted: Wed 12 Aug '15 9:52    Post subject: |   |  
| 
 |  
| Well, if BUILD_HOST does not already exist in Windows [1] (you set it in there manually or some other way) then you cannot pass an environment variable that does not exist. 
 I just tested it knowing full well I do not have  BUILD_HOST in my Windows environment and this is what I get;
 
 [Wed Aug 12 00:27:29.553800 2015] [env:warn] [pid 3072:tid 612] AH01506: PassEnv variable BUILD_HOST
 was undefined
 
 So, I think what was actually used in the OPs 1.3.9 (wow is that old) was SetEnv or they were running Win98 when there were not separate user/system environments. Or they are trying to pass a user land envvar [2]
 
 SetEnv BUILD_HOST "some value"
 
 [1] The environment variables in Windows like PATH and COMSPEC can be found in
 control panel -> system -> {advanced system settings ->} advanced tab -> environment variables button.
 
 Depending on the version of Windows the {} stuff is not there (begining in Vista, extra steps = better productivity)
   
 [2] There is user and system variables. Only the system variables can be passed when Apache is running as a service.
 |  | 
| Back to top |  | 
| jraute 
 
  
 Joined: 13 Sep 2013
 Posts: 188
 Location: Rheinland, Germany
 
 | 
|  Posted: Wed 12 Aug '15 15:57    Post subject: |   |  
| 
 |  
| Good to know, thanks, but then i was not that wrong  |  | 
| Back to top |  |