[Rails] Setting RAILS_ENV: Apache 1.3.x + fastcgi

Chris Mear chris at odegy.com
Wed Feb 1 02:11:47 GMT 2006


On 18 Oct 2005, at 4:07 pm, Louis J Scoras wrote:

> I'm trying to get rails running under fastcgi, but the  
> fastcgi.crash.log indicates that it can't find the "project_dev"  
> database.  Which is correct, because that database doesn't exist.
>
> The thing is, the RAILS_ENV doesn't seem to be getting set  
> correctly.  I'm basing the config file off of the example in the  
> Prag Rails book.  My FastCgiServer entry looks like this:
>
>     FastCgiServer /home/scora002/typo/public/dispatch.fcgi \
>       -initial-env RAILS_ENV=production -processes 2 -idle-timeout 60
>
> I know that Apache is finding and running this line correctly,  
> because if I change the number of processes and restart the server,  
> I can see that the number of processes it spawns does indeed change.

I've just fixed a similar problem on my server. It turned out that  
I'd forgotten to edit the .htaccess file to point at dispatch.fcgi  
instead of dispatch.cgi.

So Apache was spawning FastCGI processes okay, but the requests were  
actually getting handled via CGI, which was defaulting to the  
development environment.

Could this be the case on your server?

Chris



More information about the Rails mailing list