How do I use Ruby scripts?
Our Web hosting service allows you to use CGI scripts created in the Ruby programming language. We currently have Ruby version 2.1.5 available.
Note that using the Ruby language directly for CGI scripts is separate from using Ruby on Rails, which we have a separate page about (and for which we no longer support new installations).
Installing a Ruby script as a CGI
Here are some tips on using Ruby for CGI scripts:
1. Use the correct Ruby location
Make sure that the first line of your script points to the correct location of Ruby on our servers.
If you expect your script to be compatible with any version of Ruby, you should use this path:
This is the default “path” to the recommended Ruby version on our servers. That’s currently version 2.1.5, but will be updated from time to time to match the Debian Linux stable version.
2. Publish using text (ASCII) mode in your FTP program
Use your FTP program to upload the script file in text mode (sometimes called "ASCII mode"), not "binary" mode. Although text mode is the default for most FTP programs, your Ruby script may not work if it's accidentally uploaded using binary mode, so it's wise to check.
3. Put the script in the cgi-bin directory
When you upload the script, place it in a directory (folder) named cgi-bin using your FTP program. You will need to create this directory the first time you upload a script.
(Advanced users can make other directories run scripts like the "cgi-bin" directory; see our "Making Additional Directories Executable" page for more information.)
4. Make the script executable
Set the file permissions to make your script "executable" after uploading (you'll sometimes see this process referred to as making the script permissions "mode 0755" or "mode 0700").
Your FTP program documentation should explain how to create directories, transfer a file in ASCII mode, and change the permissions of a file you've uploaded.
5. Use the Script Checker
You can use our Script Checker to verify that the script was uploaded properly. The page also gives you a quick way to make the file executable if you prefer to do that on the Web, rather than using your FTP program.
6. Test the script
Once your Ruby script is installed, you'll access it as:
... where "script.rb" is the actual name of your Ruby script.
Copyright © 2000-2019 Tiger Technologies LLC