GoDaddy Ruby Tutorial

Helpful hints for using GoDaddy and Ruby together. 

Return To Ruby Scripts Home

There is plenty of documentation about how to use GoDaddy with Ruby on Rai1s, but not so much for just Ruby scripts alone. Ruby is much more functional, and sometimes simpler than other languages such as Perl or PHP.

To get started using Ruby with GoDaddy, begin with a simple "Hello World" script.

#!/usr/local/bin/ruby -w
# index.cgi
puts "Content-Type: text/html"
puts "Hello World!"

Then upload this script to any directory on your GoDaddy account. Now change permissions to this script to 755 (if you are using a FTP program, make sure every Execute box is checked).

Now view your program at

With GoDaddy hosting, you can not name your scripts *.rb, they must be *.cgi.

To use any of the Ruby Gems with GoDaddy in a Ruby Script, call 'require "rubygems"', then 'require "gemname"'. For example:

require "rubygems"
require "mysql"

If you have extensively long files, you can try to break them up into smaller ones. If you have a login function (def login), you can save it to login.rb in the same directory as your script. Then simply call 'require "login"' to load the login file.