Forum: Ruby getting 500 error while deploying to bluehost please help

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
F6c52c603b89bcb38f4054e8d4df0c04?d=identicon&s=25 Saurabh Agarwal (sagarwal1981)
on 2009-07-14 19:57
Hi All,

I am getting 500 error while deploying to bluehost , please provide some

 request failed: error reading the headers, referer: [Tue Jul 14 11:38:39 2009]

mod_fcgid: process /usr/local/cpanel/cgi-sys/default.fcgi(15024)
exit(idle timeout), get stop signal 15
`__send__': You have a nil object when you didn't expect it!
(NoMethodError) The error occurred while evaluating nil.env_table from
`dispatch_cgi' from
`dispatch_cgi' from
`dispatch' from dispatch.cgi:10

Bec38d63650c8912b6ba9b557fb953b9?d=identicon&s=25 Roger Pack (rogerdpack)
on 2009-07-15 16:48
Saurabh Agarwal wrote:
> Hi All,
> I am getting 500 error while deploying to bluehost , please provide some
> pointer

Pointer 1
don't deploy to bluehost
pointer 2
if you must, then here's how I did it.
Josh (Guest)
on 2009-07-20 03:12
(Received via mailing list)
I was running into similar issues. Mine was due to an old .htaccess
file. I put together the info I got, plus a yet to be posted rails
install update for bluehost at
Josh (Guest)
on 2009-07-23 09:07
(Received via mailing list)
Well, bluehost is back at it again, this time they installed 2.3.3 1
day after 2.3.2 and put in a bunch of new gems, including rack. Fcgi
stopped working again and here is the quick steps I took to fix it.
Hopefully bluehost will make systemwide changes instead of making us
all install local gems to fix their mistakes

This is the workaround I cam up with

Here is a ticket I entered for lighthouse... maybe the conversation
will continue there.
Bec38d63650c8912b6ba9b557fb953b9?d=identicon&s=25 Roger Pack (rogerdpack)
on 2009-07-23 15:24
> Here is a ticket I entered for lighthouse... maybe the conversation
> will continue there.

It's hard to read on that lighthouse page.
You really need to freeze your rails!
nreckart (Guest)
on 2009-07-23 19:00
(Received via mailing list)
On Jul 22, 7:58 pm, Josh <> wrote:
> > > =r
> > > --
> > > Posted via

I too was affected when Bluehost upgraded to Rails 2.3.3. My app had
been running just fine frozen to Rails 2.3.2. The day Bluehost
upgraded to 2.3.3 the app broke.

The following error was found in my fastcgi.crash.log

[23/Jul/2009:10:00:28 :: 23983] Dispatcher failed to catch: undefined
method `read' for class `FCGI::Stream' (NameError)  /usr/lib/ruby/gems/
103:in `process_request'  /home/username/rails/app/vendor/rails/
railties/lib/fcgi_handler.rb:153:in `with_signal_handler'
101:in `process_request'
78:in `process_each_request'
`session'  /usr/lib/ruby/gems/1.8/gems/fcgi-0.8.7/lib/fcgi.rb:104:in
  /usr/lib/ruby/gems/1.8/gems/fcgi-0.8.7/lib/fcgi.rb:36:in `each'
77:in `process_each_request'
76:in `catch'  /home/username/rails/app/vendor/rails/railties/lib/
fcgi_handler.rb:76:in `process_each_request'
51:in `process!'
23:in `process!'
unhandled dispatch error

Josh's message got me on the right track to a fix, but didn't quite
work. I believe this is in fact a bug in the rack gem.

Step 1: Install the rack gem locally

gem install rack

Step 2: Fix the bug in the locally installed rack gem

Edit /path/to/local/gems/rackrack-1.0.0/lib/rack/handler/fastcgi.rb.
Move line #7 to just below the definition of the read method. It
should look as follows.

class FCGI::Stream
  def read(n, buffer=nil)
    buf = _rack_read_without_buffer n
    buffer.replace(buf.to_s)  if buffer
  alias _rack_read_without_buffer read

You can determine the path to your locally installed gems by running
'gem env'. Look for 'INSTALLATION DIRECTORY'.

Step 3: Tell your rails app to use the local gem instead of the system

Edit the environment.rb file for your application and add the
following to the top.

ENV['GEM_PATH'] = '/path/to/local/ruby/gems'

Use the path exactly as listed next to 'INSTALLATION DIRECTORY' when
you run 'gem env'. In my case, it was /home/username/ruby/gems. You
should not need to specify the path to the global system gems.

Step 4: Kill any running dispatch.fcgi processes

killall -u username dispatch.fcgi

Step 5: Try to access your app

At this point my rails app started with no problem. It's still frozen
to Rails 2.3.2.

I hope this helps somebody.
This topic is locked and can not be replied to.