From: Paul Date: 2005-06-04T15:00:26+09:00 Subject: Re: erb/apache problem This is how I got 1.6 to work on an unamed popular (read cheap) host. 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.

Hope this helps.