Dreaded Internal 500 Error on DreamHost

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.”

(480) 235-5201

On 1/14/06, Jim J. [email protected] 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 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


Jon S.
[email protected]

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 :frowning: 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
(480) 235-5201

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
(480) 235-5201

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)

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

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. [email protected] wrote:

www.DontTrustThisGuy.com

make any edits at all to the .htaccess file that is created if you
www.DontTrustThisGuy.com

app, configured and migrated to the latest version of the db, and

www.DontTrustThisGuy.com
Jon S.

4034 skippack pike
v. 267.640.2195
f. 215.689.1454


http://brantinteractive.com
[email protected]
4034 skippack pike
v. 267.640.2195
f. 215.689.1454

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

On 1/15/06, Jim J. [email protected] 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
[email protected]
http://lists.rubyonrails.org/mailman/listinfo/rails


http://brantinteractive.com
[email protected]
4034 skippack pike
v. 267.640.2195
f. 215.689.1454