From: Paul Date: 2005-05-30T14:05:21+09:00 Subject: Re: How to get erb to process .rhtml or .rtml files Got it working. If anyone's interested here's the steps. Added to .htaccess in /htdocs .... AddHandler cgi-script .rb Action application/x-httpd-ruby /usr/local/bin/ruby16? AddHandler rubypage .rhtml .rtml Action rubypage /erbrun.cgi? ..... created erbrun.cgi, placed in /htdocs .... #!/usr/local/bin/ruby16 -I/www/m/mysite/cgi-bin/ruby/lib/ruby/1.8 puts "Content-type: text/html\n\n" require 'erb/erb' fh = File.new( ENV['DOCUMENT_ROOT'] + ARGV[0] ) eruby_script = fh.read erb = ERb.new(eruby_script) print erb.result( binding ) ..... placed in /htdocs create try.rhtml & place on server somewhere .... eruby example

Enumeration

Environment variables

<%ENV.keys.sort.each do |key|%> <%end%>
<%=key%><%=ENV[key]%>
..... browse to www.mysite.com/somewhere/try.rhtml and it works . create testruby.rb somewher on the server .... #!/usr/local/bin/ruby16 puts "Content-type: text/html\n\n" puts "
Test\n"
print `ls -alF /usr/local/lib/ruby/1.6/`
.....

testruby.rb also works from the browser. 

:)