CAn't get ruby to work

software development


I can’t get anything to work here I can’t get it to show. please help


How are we supposed to help you with a post like that? :open_mouth:



I’m sorry I just keep getting 500 internal server errors I setup rails and everything and fastcgi so I have no idea why its not working.


A good place to start would be to inspect your error logs to see what additional clues they might provide as to the source of your problems(s)

You can find your logs within the “logs” directory of your user space when you log in via the shell or connect via ftp.

There are a lot of things that could go wrong when you “setup rails and everything and fastcgi”, so you have to start somewhere, and your logs are as good a place as any! :wink:



I don’t understand the errors all they are is
[Sun Feb 24 12:26:35 2008] [error] [client] Premature end of script headers: hello1.cgi


[Sun Feb 24 11:51:19 2008] [error] [client] Premature end of script headers: hello2.cgi

I can’t understand all I’m trying to do is

for hello1.cgi the code is


puts "Content-Type: text/html"
puts ""
puts ""
puts "

Hello Ruby!

puts ""
puts “”

and for hello2.cgi
:: #!/usr/bin/ruby
:: # hello2.cgi
:: require ‘cgi’
:: # Create a cgi object, with HTML 4 generation methods.
:: cgi =’‘html4’’)
:: # Ask the cgi object to send some text out to the browser.
:: cgi.out {
:: cgi.html {
:: cgi.body {
:: cgi.h1 { ‘‘Hello Ruby!’’ }
:: }
:: }
:: }


This can very likely mean there is a problem with the format of your hello1.cgi and hello2.cgi files. Did you produce these files with a *nix editor, and are you sure they have *nix style" line endings?

Secondly did you upload them to your space in ASCII mode?

I assume you have them set to executable permissions also, right?

I just took your hello1.cgi code from your post, placed it onto a DH server (I created the file with nano from within the shell), set it’s permissions to 755, and it runs fine! :wink:



Still doesn’t work
and I tried to upload them in ASCII and I chmod it to 755
I’m using gVim and I have no idea what you mean by unix style line endings.


Well, then something is “not right” with your setup or your file. I suggest before you start using rails and fastcgi, you first make sure you can run hello1.cgi from a “stock” DreamHost account.

Until you can do that, you will only complicate matters considerably by trying to run fastcgi and rails.

This should give you all you need to know about “*nix style line endings” , though gVim should be giving you those by default.



I’m trying it in nano but how do I save in nano and what is a stock account


There are many different ways to “save” in nano, and a full help manual for nano is available - man nano.

Also, within nano, just type for “instant help” - there is a menu at the bottom of the screen. :wink:

By a “stock” account, I mean your DreamHost account as it was when you signed up (without any fastcgi/rails related “tweaking”).



Ok there was actually a problem with the files of rails so I reinstalled it but I have no idea what I do in database.yml
where I put all the info please help

SQLite version 3.x

gem install sqlite3-ruby (not necessary on OS X Leopard)

adapter: sqlite3
database: db/development.sqlite3
timeout: 5000

Warning: The database defined as ‘test’ will be erased and

re-generated from your development database when you run ‘rake’.

Do not set this db to the same as development or production.

adapter: sqlite3
database: db/test.sqlite3
timeout: 5000

adapter: sqlite3
database: db/production.sqlite3
timeout: 5000


That’s another whole subject, and should really be a new thread. :wink:

[quote]I have no idea what I do in database.yml
where I put all the info please help [/quote]
You ought to read that first link I gave you one more time.

Just like *nix line endings, and the use of nano, there is a lot of information about what to “do in database.yml” to be found on the web with a little google grease (just search and read). I don’t mind helping you, but you probably should do some of the research on this stuff yourself and make an effort to understand what you are trying to do before asking others to “walk you through” each step. :wink:

I’m sure that, once you have done some studying and some research on your own, if you open a new thread about your database.yml problem with a specific question, there are those here who will help you further. Good Luck!