I am trying to get eruby OR erubis installed on my Apache (2.2.3) webserver so I can run inline ruby code on .rhtml files --

I am not great with command line and shell scripting, I'm experimenting and trying to learn new things but I cannot for the life of me get anything working properly.

I have Ruby (v 1.9.2p290) installed, I know it's working properly because I can run some simple ruby expressions through the shell, eg:

#puts "Hello World"
Hello, World!

I have Ruby Gem (v 1.8.23) working.

I was also able to get Rails (v 3.2.3) successfully installed (via gem) and got a simple rails app working after following the guide at guides.rubyonrails.org/getting_started.html

And I'm not trying to get erubis (at first) and now eruby running so I can play with some simple inline ruby (ala PHP, which I am very familiar with) --

I installed Erubis (via gems) and have v 2.7.0 running. I looked all over the erubis site for more detailed instructions and I feel like I have done everything necessary to get it running, but it just doesn't parse the ruby expressions.

I made changes to the Apache httpd.conf doc, according to several posts I've found around google and the guide at http://www.ruby-doc.org/docs/ProgrammingRuby/html/web.html (which I feel would not actually do anything for erubis, but I tried it anyway...)

I posted on SO (because SO always helps me relatively quickly, but I have no responses on this problem) and now I'm trying to get eruby installed. I downloaded and unpacked the tar to my cgi-bin and ran # ./configure.rb and got an error concerning ftools -- I did some research and found that ftools was deprecated in Ruby 1.9 and replaced by fileutils. I tried to do some replacing and came up with more errors.

I am at a dead end, I can't find much information on this but I feel like I have to be missing something pretty simple. Is there a simpler alternative to get meet my needs? Any help or information greatly appreciated!


The first thing to check is to make sure Apache is sending rhtml files though the ruby processor (mod_ruby I'm assuming). I'm afraid there isn't much documentation on what mod_ruby requires for this, but the usual SetHandler line should take care of it.

As a side note, eruby and erubis are really not the way to go for Ruby stuff these days. You're better off going straight to Sinatra or Ruby on Rails (with Unicorn or Thin) as enthusiasm for inline ruby waned back in 2008.

  • wow thanks so much -- I was thinking that perhaps there was a better way (since a lot of the files I was looking at were many many years old) -- I just got sinatra up and running in about 15 mins and it's wonderful. I was playing with rails yesterday and it just seemed too big for what I'm trying to do, sinatra feels light and much simpler -- at least to begin with, thanks! – thomas Apr 25 '12 at 1:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.