# Help getting rails application working on fastcgi on dreamho

**URL:** <https://www.ruby-forum.com/t/help-getting-rails-application-working-on-fastcgi-on-dreamho/73104>\
**Category:** Rails\
**Created:** [October 21, 2006, 1:59pm UTC](https://www.ruby-forum.com/t/help-getting-rails-application-working-on-fastcgi-on-dreamho/73104 "2006-10-21T13:59:06Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![greg](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/71c47a/32.png) [@greg](https://www.ruby-forum.com/u/greg)\
**Post date:** [October 21, 2006, 1:59pm UTC](https://www.ruby-forum.com/t/help-getting-rails-application-working-on-fastcgi-on-dreamho/73104/1 "2006-10-21T13:59:06Z")

</div>

Hi,

I’ve previously had a rails application up and running on dreamhost  
using  
fastcgi, however have just recently performed a “cap deploy” but have  
had  
problems:

- I get a long wait period after browsing to the application and  
finially it  
returns “Application Error - Rails application failed to start properly”
- No entries in the rails production (or development) logs
- No fastcgi.crash.log entries
- In the /log/http error.log I see "FastCGI: incomplete headers (0  
bytes)  
received from server "
- If I run dispatch.rb  
[skybar]$ ruby dispatch.rb  
./…/config/environment.rb:3: uninitialized constant RAILS\_ROOT  
(NameError)  
from dispatch.rb:4:in `require’  
from dispatch.rb:4

Can anyone help with some fault finding tips re how to track down whats  
going wrong?

Note that I have made sure:

- log/temp & dispatch.fcgi are writeable
- have issued “killall -9 ruby”
- etc

Thanks in advance  
Greg

---

<div class="post-metadata">

**Author:** ![greg](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/71c47a/32.png) [@greg](https://www.ruby-forum.com/u/greg)\
**Post date:** [October 21, 2006, 3:08pm UTC](https://www.ruby-forum.com/t/help-getting-rails-application-working-on-fastcgi-on-dreamho/73104/2 "2006-10-21T15:08:31Z")

</div>

Greg H. wrote:

> Can anyone help with some fault finding tips re how to track down whats  
> going wrong?

Have you made certain the hashbang lines on your dispatch scripts are  
correct for the host?

These need to be absolute paths to the copy of ruby you’re running,  
“#!/usr/bin/env ruby” can’t be relied on because there is no useful  
environment when they are called by Apache.

After you try to access your site, are there any copies of dispatch.fcgi  
running on the host (pa aux in an ssh window will tell you)? If not,  
they’re not getting started up, for one reason or another.

–Al Evans

---

<div class="post-metadata">

**Author:** ![greg](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/71c47a/32.png) [@greg](https://www.ruby-forum.com/u/greg)\
**Post date:** [October 21, 2006, 11:28pm UTC](https://www.ruby-forum.com/t/help-getting-rails-application-working-on-fastcgi-on-dreamho/73104/3 "2006-10-21T23:28:40Z")

</div>

PS. I did not that in ~/logs//http/error.log there are the  
follow 2  
entries that show up after a timeout period of the browser not returning  
correctly:

- FastCGI: comm with (dynamic) server “/public/dispatch.fcgi”  
aborted: (first read) idle timeout (120 sec)

- FastCGI: incomplete headers (0 bytes) received from server "  
/public/dispatch.fcgi"

Does this help? Anyone know how to fix this?

---

<div class="post-metadata">

**Author:** ![greg](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/71c47a/32.png) [@greg](https://www.ruby-forum.com/u/greg)\
**Post date:** [October 23, 2006, 10:17pm UTC](https://www.ruby-forum.com/t/help-getting-rails-application-working-on-fastcgi-on-dreamho/73104/4 "2006-10-23T22:17:53Z")

</div>

hi Bharat

- Checked for hidden ^M’s but none were there so this should be ok?
- database credentials are fine (tried a "mysql -h asdf -u …etc)

Any other ideas re getting fastcgi working again on dream host. Again  
there  
are no rails or fcgicrash logs that appear. I’ve got no real idea how  
to  
try to track it down?

Tks

---

<div class="post-metadata">

**Author:** ![greg](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/71c47a/32.png) [@greg](https://www.ruby-forum.com/u/greg)\
**Post date:** [October 23, 2006, 10:30pm UTC](https://www.ruby-forum.com/t/help-getting-rails-application-working-on-fastcgi-on-dreamho/73104/5 "2006-10-23T22:30:05Z")

</div>

PS - I wonder if it could be something to do with copying in the full  
set of  
directories for my rails application upsetting something to do with the  
dreamhost setting for my site? For example whether I have to reforce my  
site to be “fastcgi” enabled or something like that? (even though on the  
dreamhost panel if I look it is still showing this subdomain to be  
fastcgi  
enabled)

---

<div class="post-metadata">

**Author:** ![greg](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/71c47a/32.png) [@greg](https://www.ruby-forum.com/u/greg)\
**Post date:** [October 24, 2006, 12:46am UTC](https://www.ruby-forum.com/t/help-getting-rails-application-working-on-fastcgi-on-dreamho/73104/6 "2006-10-24T00:46:26Z")

</div>

Greg H. wrote:

> PS - I wonder if it could be something to do with copying in the full  
> set of  
> directories for my rails application upsetting something to do with the  
> dreamhost setting for my site? For example whether I have to reforce my  
> site to be “fastcgi” enabled or something like that? (even though on the  
> dreamhost panel if I look it is still showing this subdomain to be  
> fastcgi  
> enabled)

Do you have the “web directory” field in the setup panel pointed to your  
public directory, e.g., /home//\<rails\_directory\>/public?

–Al Evans

---

<div class="post-metadata">

**Author:** ![greg](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/71c47a/32.png) [@greg](https://www.ruby-forum.com/u/greg)\
**Post date:** [October 23, 2006, 10:45am UTC](https://www.ruby-forum.com/t/help-getting-rails-application-working-on-fastcgi-on-dreamho/73104/7 "2006-10-23T10:45:58Z")

</div>

did u upload the files created in windows? if so, make sure that you do  
not have an extra line break at the end of the first lines of  
dispatch.cgi/fcgi. Run ‘cat -v public/dispatch.fcgi | head -1’ and see  
if there is a hidden ‘^M’ at the end of the line. If this is ok, then  
check your database.yml to ensure that you have given the right  
credentials.

I have written a small write up on my experience setting up typo on  
bluehost. See if that helps.

Bharat  
[http://blog.publishedperspectives.com](http://blog.publishedperspectives.com)

---

<div class="post-metadata">

**Author:** ![greg](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/71c47a/32.png) [@greg](https://www.ruby-forum.com/u/greg)\
**Post date:** [October 24, 2006, 1:06pm UTC](https://www.ruby-forum.com/t/help-getting-rails-application-working-on-fastcgi-on-dreamho/73104/8 "2006-10-24T13:06:47Z")

</div>

Al - thanks a million - I believed the other posts about the hashbang  
and there was a wailing and gnashing of teeth for a couple of hours  
last night!

#!/usr/bin/ruby at the top of dispatch.fcgi capistranoised my app. on  
Dreamhost.

Thanks again.

Mr Grumpy is somewhat less so.
