# Apache / FastCGI freak out in PRODUCTION mode on my new rail

**URL:** <https://www.ruby-forum.com/t/apache-fastcgi-freak-out-in-production-mode-on-my-new-rail/99715>\
**Category:** Rails\
**Created:** [December 13, 2005, 4:23am UTC](https://www.ruby-forum.com/t/apache-fastcgi-freak-out-in-production-mode-on-my-new-rail/99715 "2005-12-13T04:23:57Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![subimage\_interactiv](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/c37758/32.png) [@subimage\_interactiv](https://www.ruby-forum.com/u/subimage_interactiv)\
**Post date:** [December 13, 2005, 4:23am UTC](https://www.ruby-forum.com/t/apache-fastcgi-freak-out-in-production-mode-on-my-new-rail/99715/1 "2005-12-13T04:23:57Z")

</div>

Here I go again with another question. I’ve been banging my head for the  
better part of a week against this one, so responses would be really  
appreciated.

I have a Rails application that I’ve been developing under  
Apache/FastCGI in  
_development_ mode. All is well and works wonderfully, until I change my  
httpd.conf from this:

 FastCgiServer /var/www/genselect/public/dispatch.fcgi \ -initial-env RAILS\_ENV=development \ -processes 2 \ -idle-timeout 60

To this:

 FastCgiIpcDir /tmp/fcgi\_ipc FastCgiServer /var/www/genselect/public/dispatch.fcgi \ -initial-env RAILS\_ENV=production \ -processes 2 \ -idle-timeout 60

When I do that, the site won’t come up at all in my browser and I get  
this  
in my apache error\_log:

[Mon Dec 12 19:01:09 2005] [error] [client 192.169.1.1] FastCGI: comm  
with  
server “/var/www/genselect/public/dispatch.fcgi” aborted: idle timeout  
(60  
sec)  
[Mon Dec 12 19:01:09 2005] [error] [client 192.169.1.1] FastCGI:  
incomplete  
headers (0 bytes) received from server  
“/var/www/genselect/public/dispatch.fcgi”

I have another rails application running in production mode on the same  
machine, and it works fine - so I know how to get it done. I’ve even  
removed  
my previous rails app from the httpd.conf to test if there is some sort  
of  
FCGI collision going on, but there’s not - my new app still fails to  
start  
up in production mode.

My _old_ rails app is something I started on 0.13 (and I’m pretty sure I  
haven’t updated). I noticed the environment.rb files are very different  
between the two, but the 0.13 one still works just fine. (My new rails  
app  
is 0.14.4)

My database settings are all kosher (I’ve even pointed production /  
development mode to the same database with no luck), and I’ve cleared  
sessions out of my DB between restarts.

I’ve commented everything out of production.rb, but still no luck. I’m  
going  
crazy here - does anyone have an idea what could be causing my problems?

---

<div class="post-metadata">

**Author:** ![subimage\_interactiv](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/c37758/32.png) [@subimage\_interactiv](https://www.ruby-forum.com/u/subimage_interactiv)\
**Post date:** [December 13, 2005, 4:35am UTC](https://www.ruby-forum.com/t/apache-fastcgi-freak-out-in-production-mode-on-my-new-rail/99715/2 "2005-12-13T04:35:58Z")

</div>

Alright - I feel really stupid, but I just solved it literally seconds  
after  
I posted the message.

Someone on the irc channel suggested that I run webrick in prodcution  
mode.  
It gave me this

/usr/lib/ruby/gems/1.8/gems/activerecord-1.13.1/lib/active\_record/connection\_adapters/abstract/connection\_specification.rb:73:in  
`establish\_connection’: production database is not configured  
(ActiveRecord::AdapterNotSpecified)

So I checked out my database.yml file again and found out that I had a  
SPACE  
on the line between test and production mode, and THAT was causing the  
problem.

Just in case someone else has the same problem one day - look at your  
database.yml file really closely.

---

<div class="post-metadata">

**Author:** ![subimage\_interactiv](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/c37758/32.png) [@subimage\_interactiv](https://www.ruby-forum.com/u/subimage_interactiv)\
**Post date:** [December 13, 2005, 4:08pm UTC](https://www.ruby-forum.com/t/apache-fastcgi-freak-out-in-production-mode-on-my-new-rail/99715/3 "2005-12-13T16:08:14Z")

</div>

On 12/12/05 10:22 PM, “subimage interactive” [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> I’ve commented everything out of production.rb, but still no luck. I’m going  
> crazy here - does anyone have an idea what could be causing my problems?

A few notes that might help…

I’m personally having an issue wherein I’m using a very similar FastCGI  
config line, but it’s not passing the production flag over to the app  
properly – and thus is was always trying to start in development. Mine  
looks like:

FastCgiIpcDir /tmp/fcgi\_ipc FastCgiServer /webserver/cbwebsite/releases/rel29/public/dispatch.fcgi \ -initial-env RAILS\_ENV=production -processes 5 -idle-timeout 120

To fix it I’ve temporarily told Rails to run in production by hand in  
the  
environment.rb file but I’d really like to know why the above isn’t  
working.

Some issues I ran into before but are now solved:

For some reason the temp folder (/tmp/fcgi\_ipc) was initially owned by  
my  
user, and then when I tried to boot the server www couldn’t write into  
it. I  
deleted it, restarted apache and only then could it create a new folder  
that  
was owned by www and would work.

## Finally, another issue I once has was the shebang line in dispatch.fcgi

it was pointed to a previous ruby install, and not my current one which  
knew  
where to find FastCGI.

Good luck.

## ~ Mike

> **[Home - Mike Zornek](https://mikezornek.com/)**
>
> Sharing life and geek notes from Philadelphia.
