# Getting 500 error while deploying to bluehost please help

**URL:** <https://www.ruby-forum.com/t/getting-500-error-while-deploying-to-bluehost-please-help/172097>\
**Category:** Ruby\
**Created:** [July 14, 2009, 7:57pm UTC](https://www.ruby-forum.com/t/getting-500-error-while-deploying-to-bluehost-please-help/172097 "2009-07-14T19:57:30Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![sagarwal1981](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/4bbf92/32.png) [@sagarwal1981](https://www.ruby-forum.com/u/sagarwal1981)\
**Post date:** [July 14, 2009, 7:57pm UTC](https://www.ruby-forum.com/t/getting-500-error-while-deploying-to-bluehost-please-help/172097/1 "2009-07-14T19:57:30Z")

</div>

Hi All,

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

request failed: error reading the headers, referer:  
[http://unimasr.com/community/portal.php](http://unimasr.com/community/portal.php) [Tue Jul 14 11:38:39 2009]  
[notice]

mod\_fcgid: process /usr/local/cpanel/cgi-sys/default.fcgi(15024)  
exit(idle timeout), get stop signal 15  
/usr/lib/ruby/gems/1.8/gems/actionpack-2.3.2/lib/action\_controller/cgi\_process.rb:22:in  
` __send__': You have a nil object when you didn't expect it! (NoMethodError) The error occurred while evaluating nil.env_table from /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.2/lib/action_controller/cgi_process.rb:22:in `dispatch\_cgi’ from  
/usr/lib/ruby/gems/1.8/gems/actionpack-2.3.2/lib/action\_controller/dispatcher.rb:102:in  
`dispatch_cgi' from /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.2/lib/action_controller/dispatcher.rb:28:in `dispatch’ from dispatch.cgi:10

Thanks  
Saurabh

---

<div class="post-metadata">

**Author:** ![sagarwal1981](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/4bbf92/32.png) [@sagarwal1981](https://www.ruby-forum.com/u/sagarwal1981)\
**Post date:** [July 15, 2009, 4:48pm UTC](https://www.ruby-forum.com/t/getting-500-error-while-deploying-to-bluehost-please-help/172097/2 "2009-07-15T16:48:59Z")

</div>

Saurabh A. 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.  
[http://betterlogic.com/roger/?p=368](http://betterlogic.com/roger/?p=368)  
=r

---

<div class="post-metadata">

**Author:** ![sagarwal1981](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/4bbf92/32.png) [@sagarwal1981](https://www.ruby-forum.com/u/sagarwal1981)\
**Post date:** [July 20, 2009, 3:12am UTC](https://www.ruby-forum.com/t/getting-500-error-while-deploying-to-bluehost-please-help/172097/3 "2009-07-20T03:12:05Z")

</div>

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

> **[Welcome jibwa.com - BlueHost.com](http://jibwa.com/code-and-documentation-for-programmers/bluehost-rails-update-cgi-problems.html)**
>
> Bluehost - Top rated web hosting provider - Free 1 click installs For blogs, shopping carts, and more. Get a free domain name, real NON-outsourced 24/7 support, and superior speed. web hosting provider php hosting cheap web hosting, Web hosting,...

.

---

<div class="post-metadata">

**Author:** ![sagarwal1981](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/4bbf92/32.png) [@sagarwal1981](https://www.ruby-forum.com/u/sagarwal1981)\
**Post date:** [July 23, 2009, 3:24pm UTC](https://www.ruby-forum.com/t/getting-500-error-while-deploying-to-bluehost-please-help/172097/4 "2009-07-23T15:24:19Z")

</div>

> Here is a ticket I entered for lighthouse… maybe the conversation  
> will continue there.  
> [#2941 2.3.3 fcgi problem - Ruby on Rails - rails](https://rails.lighthouseapp.com/projects/8994/tickets/2941-233-fcgi-problem)

It’s hard to read on that lighthouse page.  
You really need to freeze your rails!  
=r

---

<div class="post-metadata">

**Author:** ![sagarwal1981](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/4bbf92/32.png) [@sagarwal1981](https://www.ruby-forum.com/u/sagarwal1981)\
**Post date:** [July 23, 2009, 9:07am UTC](https://www.ruby-forum.com/t/getting-500-error-while-deploying-to-bluehost-please-help/172097/5 "2009-07-23T09:07:28Z")

</div>

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

> **[Welcome jibwa.com - BlueHost.com](http://jibwa.com/code-and-documentation-for-programmers/more-bluegost-fcgi-issues-with-rails-2.3.3-and.html)**
>
> Bluehost - Top rated web hosting provider - Free 1 click installs For blogs, shopping carts, and more. Get a free domain name, real NON-outsourced 24/7 support, and superior speed. web hosting provider php hosting cheap web hosting, Web hosting,...

Here is a ticket I entered for lighthouse… maybe the conversation  
will continue there.  
[https://rails.lighthouseapp.com/projects/8994/tickets/2941-233-fcgi-problem](https://rails.lighthouseapp.com/projects/8994/tickets/2941-233-fcgi-problem)

---

<div class="post-metadata">

**Author:** ![sagarwal1981](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/4bbf92/32.png) [@sagarwal1981](https://www.ruby-forum.com/u/sagarwal1981)\
**Post date:** [July 23, 2009, 7:00pm UTC](https://www.ruby-forum.com/t/getting-500-error-while-deploying-to-bluehost-please-help/172097/6 "2009-07-23T19:00:59Z")

</div>

On Jul 22, 7:58 pm, Josh [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> > > ## =r
> > > 
> > > Posted viahttp://www.ruby-forum.com/.

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/  
1.8/gems/rack-1.0.0/lib/rack/handler/fastcgi.rb:7  
/home/username/rails/app/vendor/rails/railties/lib/fcgi\_handler.rb:  
103:in `process_request' /home/username/rails/app/vendor/rails/ railties/lib/fcgi_handler.rb:153:in `with\_signal\_handler’  
/home/username/rails/app/vendor/rails/railties/lib/fcgi\_handler.rb:  
101:in `process_request' /home/username/rails/app/vendor/rails/railties/lib/fcgi_handler.rb: 78:in `process\_each\_request’  
/usr/lib/ruby/gems/1.8/gems/fcgi-0.8.7/lib/fcgi.rb:117:in  
`session' /usr/lib/ruby/gems/1.8/gems/fcgi-0.8.7/lib/fcgi.rb:104:in `each\_request’  
/usr/lib/ruby/gems/1.8/gems/fcgi-0.8.7/lib/fcgi.rb:36:in `each' /home/username/rails/app/vendor/rails/railties/lib/fcgi_handler.rb: 77:in `process\_each\_request’  
/home/username/rails/app/vendor/rails/railties/lib/fcgi\_handler.rb:  
76:in `catch' /home/username/rails/app/vendor/rails/railties/lib/ fcgi_handler.rb:76:in `process\_each\_request’  
/home/username/rails/app/vendor/rails/railties/lib/fcgi\_handler.rb:  
51:in `process!' /home/username/rails/app/vendor/rails/railties/lib/fcgi_handler.rb: 23:in `process!’  
dispatch.fcgi:24  
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  
buf  
end  
alias \_rack\_read\_without\_buffer read  
end

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  
gem

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.
