# Dreaded Internal 500 Error on DreamHost

**URL:** <https://www.ruby-forum.com/t/dreaded-internal-500-error-on-dreamhost/52488>\
**Category:** Rails\
**Created:** [January 15, 2006, 1:40am UTC](https://www.ruby-forum.com/t/dreaded-internal-500-error-on-dreamhost/52488 "2006-01-15T01:40:03Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![aantix](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/f0a364/32.png) [@aantix](https://www.ruby-forum.com/u/aantix)\
**Post date:** [January 15, 2006, 1:40am UTC](https://www.ruby-forum.com/t/dreaded-internal-500-error-on-dreamhost/52488/1 "2006-01-15T01:40:03Z")

</div>

Hey guys,

I often get this problem the first time I try to deploy a rails app  
on dreamhost and I’m not sure what the cause is. Basically, I have  
an app that’s running fine on my local machine. I’ve uploaded the  
app, configured and migrated to the latest version of the db, and set  
all of the necessary directories to 755. But when I run dispatch.rb  
in ssh or access the site from a web browser it returns an Internal  
500 error. I have no errors in my logs. Any ideas?

* * *

Jim J.  
“A trustworthy individual.”

> **[The personal blog of Jim Jeffers | DontTrustThisGuy.com](http://www.donttrustthisguy.com)**
>
> The personal blog of Jim Jeffers.

(480) 235-5201

---

<div class="post-metadata">

**Author:** ![aantix](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/f0a364/32.png) [@aantix](https://www.ruby-forum.com/u/aantix)\
**Post date:** [January 15, 2006, 2:34am UTC](https://www.ruby-forum.com/t/dreaded-internal-500-error-on-dreamhost/52488/2 "2006-01-15T02:34:32Z")

</div>

On 1/14/06, Jim J. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Hey guys,
> 
> I often get this problem the first time I try to deploy a rails app  
> on dreamhost and I’m not sure what the cause is. Basically, I have  
> an app that’s running fine on my local machine. I’ve uploaded the  
> app, configured and migrated to the latest version of the db, and set  
> all of the necessary directories to 755. But when I run dispatch.rb  
> in ssh or access the site from a web browser it returns an Internal  
> 500 error. I have no errors in my logs. Any ideas?

In [panel.dreamhosters.com](http://panel.dreamhosters.com) under Manage Domains, did you change Web  
Directory to public or current/public (if using switchtower)?

Did you edit .htaccess to change .cgi to .fcgi? Make sure you don’t  
stomp that with later uploads.

cd in public and do ./dispatch.fcgi it should run and give you and  
Error 500 which is normal. If you get a compiler error you have  
problems.

Look in ~/logs for errors from Apache

> [http://lists.rubyonrails.org/mailman/listinfo/rails](http://lists.rubyonrails.org/mailman/listinfo/rails)

–  
Jon S.  
removed\_email\_address@domain.invalid

---

<div class="post-metadata">

**Author:** ![aantix](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/f0a364/32.png) [@aantix](https://www.ruby-forum.com/u/aantix)\
**Post date:** [January 16, 2006, 5:13am UTC](https://www.ruby-forum.com/t/dreaded-internal-500-error-on-dreamhost/52488/3 "2006-01-16T05:13:03Z")

</div>

My apache log files show I’m getting this error:

Error 500/Premature end of script headers

The dreamhost wiki says:  
Troubleshooting: Error 500/Premature end of script headers

1. Make sure that the public directory and dispatch.cgi inside it are  
not world-writable (chmod 755). If the problem remains, try running  
dispatch.cgi from the command line.

2. You may also get the error: “Rails application failed to start  
properly” which seems to be indicative of the same issue. You will  
have to chmod all directories in your rails application directory as  
well as public to 755.

3. Also, at least with the new rails 0.13.1, you shouldn’t have to  
make any edits at all to the .htaccess file that is created if you  
followed the rest of the directions on this page. You should at least  
be able to get the basic rails app working.

The entire site directory has now been recursively set to 755. What  
else can I do? I’m totally stumped here ☹ 9 hours to write a nice  
app. 3 days to deploy it? I’m dying here guys help!!

* * *

Jim J.  
“A trustworthy individual.”  
[www.DontTrustThisGuy.com](http://www.DontTrustThisGuy.com)  
(480) 235-5201

---

<div class="post-metadata">

**Author:** ![aantix](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/f0a364/32.png) [@aantix](https://www.ruby-forum.com/u/aantix)\
**Post date:** [January 16, 2006, 5:19am UTC](https://www.ruby-forum.com/t/dreaded-internal-500-error-on-dreamhost/52488/4 "2006-01-16T05:19:05Z")

</div>

Arg! Just as I get frustrated to all end I’ve found my answer. It was  
my shebang line. The default one rails uses is not friendly with DH.

* * *

Jim J.  
“A trustworthy individual.”  
[www.DontTrustThisGuy.com](http://www.DontTrustThisGuy.com)  
(480) 235-5201

---

<div class="post-metadata">

**Author:** ![aantix](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/f0a364/32.png) [@aantix](https://www.ruby-forum.com/u/aantix)\
**Post date:** [January 16, 2006, 5:16am UTC](https://www.ruby-forum.com/t/dreaded-internal-500-error-on-dreamhost/52488/5 "2006-01-16T05:16:04Z")

</div>

Did you develop your code on Windows? If so, make sure your end of line  
character is set correctly in the dispatch.fcgi file (open it in a Linux  
editor, make a change and save it)

---

<div class="post-metadata">

**Author:** ![aantix](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/f0a364/32.png) [@aantix](https://www.ruby-forum.com/u/aantix)\
**Post date:** [January 16, 2006, 2:33pm UTC](https://www.ruby-forum.com/t/dreaded-internal-500-error-on-dreamhost/52488/6 "2006-01-16T14:33:06Z")

</div>

When you run the ‘rails’ command to generate your application  
(including the dispatcher code) it uses the path of the instance of  
ruby currently running to generate the #! line. So unless you are  
running ruby from /usr/bin/ruby1.8 (which is what I believe Dreamhost  
has as their default ruby 1.8 binary), you’ll always have this  
problem.

I’m not sure what support DH has for using #!/usr/bin/env ruby, but if  
that does work you should be able to use it cross-platform with  
reasonable success.

- james

---

<div class="post-metadata">

**Author:** ![aantix](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/f0a364/32.png) [@aantix](https://www.ruby-forum.com/u/aantix)\
**Post date:** [January 24, 2006, 11:51pm UTC](https://www.ruby-forum.com/t/dreaded-internal-500-error-on-dreamhost/52488/7 "2006-01-24T23:51:13Z")

</div>

nevermind… my permissions were wrong on the public directory. They  
actually looked right, but i reset them and i’m up and running.

On 1/24/06, Rich B. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> > [www.DontTrustThisGuy.com](http://www.DontTrustThisGuy.com)
> > 
> > > make any edits at all to the .htaccess file that is created if you  
> > > [www.DontTrustThisGuy.com](http://www.DontTrustThisGuy.com)
> > > 
> > > > > app, configured and migrated to the latest version of the db, and
> > > > 
> > > > > [www.DontTrustThisGuy.com](http://www.DontTrustThisGuy.com)  
> > > > > Jon S.
> 
> 4034 skippack pike  
> v. 267.640.2195  
> f. 215.689.1454

–  
[http://brantinteractive.com](http://brantinteractive.com)  
removed\_email\_address@domain.invalid  
4034 skippack pike  
v. 267.640.2195  
f. 215.689.1454

---

<div class="post-metadata">

**Author:** ![aantix](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/f0a364/32.png) [@aantix](https://www.ruby-forum.com/u/aantix)\
**Post date:** [January 24, 2006, 10:35pm UTC](https://www.ruby-forum.com/t/dreaded-internal-500-error-on-dreamhost/52488/8 "2006-01-24T22:35:36Z")

</div>

Hi Jim, I’m where your were right now: What did you change your  
shebang to? thanks!

On 1/15/06, Jim J. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> > The entire site directory has now been recursively set to 755.
> > 
> > > > 500 error. I have no errors in my logs. Any ideas?
> > > 
> > > > Rails mailing list  
> > > > removed\_email\_address@domain.invalid  
> > > > [http://lists.rubyonrails.org/mailman/listinfo/rails](http://lists.rubyonrails.org/mailman/listinfo/rails)

–  
[http://brantinteractive.com](http://brantinteractive.com)  
removed\_email\_address@domain.invalid  
4034 skippack pike  
v. 267.640.2195  
f. 215.689.1454
