# Problem with environmental variables and FastCGI

**URL:** <https://www.ruby-forum.com/t/problem-with-environmental-variables-and-fastcgi/58756>\
**Category:** Rails\
**Created:** [April 25, 2006, 5:40pm UTC](https://www.ruby-forum.com/t/problem-with-environmental-variables-and-fastcgi/58756 "2006-04-25T17:40:30Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![sfmcfar](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/d9b06d/32.png) [@sfmcfar](https://www.ruby-forum.com/u/sfmcfar)\
**Post date:** [April 25, 2006, 5:40pm UTC](https://www.ruby-forum.com/t/problem-with-environmental-variables-and-fastcgi/58756/1 "2006-04-25T17:40:30Z")

</div>

Hi,

I’m trying to deploy my app using FastCGI, and I have a problem. The  
application  
works correctly in either FastCGI or CGI mode (toggling between  
dispatch.fcgi and  
dispatch.cgi in my public/.htaccess file) except that under regular CGI,  
my  
ENV hash is correctly set, but under FastCGI, the ENV hash is completely  
empty. I  
thought that environment variables were automatically passed to the  
FastCGI  
app  
as if it was a regular CGI application.

Can someone help?

Thanks,

## Stan McFarland

View this message in context:  
[http://www.nabble.com/problem-with-environmental-variables-and-FastCGI-t1506204.html#a4084539](http://www.nabble.com/problem-with-environmental-variables-and-FastCGI-t1506204.html#a4084539)  
Sent from the RubyOnRails Users forum at [Nabble.com](http://Nabble.com).

---

<div class="post-metadata">

**Author:** ![sfmcfar](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/d9b06d/32.png) [@sfmcfar](https://www.ruby-forum.com/u/sfmcfar)\
**Post date:** [April 26, 2006, 12:27am UTC](https://www.ruby-forum.com/t/problem-with-environmental-variables-and-fastcgi/58756/2 "2006-04-26T00:27:07Z")

</div>

More info:

I can access the environmental variables from the controller or the view  
by  
using @request.env - this has the environment populated successfully.  
Here’s my problem, though. I need to be able to access the environment  
from  
a method in a model, and @request is not defined in the model. As I  
said  
earlier, ENV is defined via CGI, which I _can_ refer to in the model,  
but  
it’s not defined if I use FastCGI.

## Any suggestions? I’m desperate. 😉

View this message in context:  
[http://www.nabble.com/problem-with-environmental-variables-and-FastCGI-t1506204.html#a4091567](http://www.nabble.com/problem-with-environmental-variables-and-FastCGI-t1506204.html#a4091567)  
Sent from the RubyOnRails Users forum at [Nabble.com](http://Nabble.com).
