Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Ruby as an Apache CGI UNIX
Hello, I've sucessfully installed Ruby, a great newish scripting language. I recommend you try it out. Anyways, it works fine by itself, but I am having problems getting it to work as a script in Apache. I've installed mod_ruby, and have followed their directions. However, I can still not get it to work under Apache. Anyone had any luck?


  • Currently 2.00 / 5
  You rated: 2 / 5 (2 votes cast)

Ruby as an Apache CGI | 1 comments | Create New Account
Click here to return to the 'Ruby as an Apache CGI' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Have you used ExecCGI?
Authored by: alunap on Aug 22, '01 10:30:24AM

Yes, I installed and used mod_ruby and eRuby (embedded ruby, like JSP but with power of Ruby). You don't say what error message you get when you try to access a page. Some ideas,
a) Did you modify httpd.conf? I simply added an Include line at the bottom to add in a separate config file for the Ruby stuff.
b) Is the folder you are using for scripts enabled for CGI? If you are specifying that mod_ruby should be run by <Location /ruby> then it needs 'Options ExecCGI' in that location setup (in httpd.conf or your included conf file). If you are matching by extension (usually .rbx) then you need to add that option to the Location or Directory item that controls access to your scripts folder. Try putting your script (ending with .rbx) into /Library/Webserver/CGI-Executables
c) If you are using eRuby, is mod_ruby set up to use it?
d) After installing, can you find the file '' in /usr/libexec/httpd and is it executable and owned by root/wheel?
e) On your script files, have you given read access to 'all'?
Otherwise, need some more information, I am afraid.

Incidentally, Ruby is a really nice language, with the great text-processing power and convenience of Perl, but very clear syntax. The problem with using it on OSX right now is that it isn't easy to create GUI apps (On other platforms it can use Tk, FX, whatever). Trolltech have released a beta of the Qt toolkit v3 for OSX, and there is a library for this (but for earlier versions). I plan to get it to use this version of Qt, and then we can write cross-platform GUI apps, but with much more convenience than Java allows.

[ Reply to This | # ]