views:

112

answers:

2

I have a basic Dreamhost account as well as an iMac running Apache2/Rails/SVN/et al. I can only get my Hello World Ruby script to execute in my iMac's cgi-bin. Dreamhost doesn't have any cgi-bin that I'm aware of.

I've CHMODed the .rb file to 755. I've tried both a shebang line that points directly to Ruby and another that uses the env path. I've tried adding an AddHandler cgi-script .rb to the httpd.conf on my iMac and to an .htaccess file on my Dreamhost account.

Viewing the .rb file my browser yields the source code. Do I need an AddType line also? What the heck am I doing wrong?

A: 

I'm assuming that you can run the .rb file on the command line in your Dreamhost account.

I'm not sure if another AddType will work, but Dreamhost probably looks for a special extension on the CGI script like .cgi

Dave Bacher
A: 

You'll probably need to rename your file to .cgi or .fcgi and make sure you include the #!/usr/bin/ruby line at the top of your file (presuming you want to use the pre-installed ruby version which is Ruby 1.8.5).

I'd take a look at on the Dreamhost wiki: Python scripting instructions and Ruby on Rails instructions.

(I included the Python instructions because it would appear what you want to do is detailed for Python, but not Ruby. You might be able to leverage it to solve your issue.)

TheClair