From: "Dr. Ephemeron" Date: 2004-03-05T06:24:42+09:00 Subject: Re: mod_ruby & Apache With Apache 1.3.28 it mostly works. Here is the test script I am running: // It works without the following 2 lines, although instructions say it needs them. print "HTTP/1.1 200 OK\r\n" print "Content-type: text/html\r\n\r\n" print "" print " eRuby Test!

" 1.upto(10) do |x| print " Hello Ruby!
\n" end print "

\n" If I try this at the start of the script, I get errors: print "HTTP/1.1 200 OK\r\n" #With or without this line is the same error. require 'cgi' cgi = CGI.new print cgi.header['type'=>'text/html'] Here is the error from the error_log: Thu Mar 4 13:16:47 2004] [error] mod_ruby: error in ruby /var/www/ruby/rubytest.rbx:6:in `[]': cannot convert Hash into Integer (TypeError) from /var/www/ruby/rubytest.rbx:6 from /usr/lib/ruby/1.8/apache/ruby-run.rb:70:in `load' from /usr/lib/ruby/1.8/apache/ruby-run.rb:70:in `handler' Here is what I added to httpd.conf to get it to work as well as it does with Apache v1.3: LoadModule ruby_module modules/mod_ruby.so # After ClearModuleList AddModule mod_ruby.c ScriptAlias /ruby/ /var/www/ruby/ AllowOverride All Options ExecCGI Order allow,deny Allow from all RubyRequire apache/ruby-run SetHandler ruby-object RubyHandler Apache::RubyRun.instance #Options ExecCGI #This is not needed since it is in the Directory directive above. RubyRequire apache/eruby-run SetHandler ruby-object RubyHandler Apache::ERubyRun.instance With Apache 2.0.47 it just loads it as a text file. In httpd.conf, I have all the same stuff above except for: AddModule mod_ruby.c #Not in httpd.conf for Apache2 eruby works fine on the web server root directory for both versions of Apache. "Kent Dahl" wrote in message news:c27k07$kcg$1@tyfon.itea.ntnu.no... > Dr. Ephemeron wrote: > > mod_ruby is reported installed by Apache and I can make a test *.rhtml file > > in my html directory and it works fine. > > > > When put a *.rbx file in my cgi-bin directory and browse it with Mozilla > > 1.4, it prints, but it prints everything in the file like this: > > > > HTTP/1.1 200 OK > > Content-type: text/html > > > > > How does the relevant sections of your httpd.conf file look? > > Do you have a "" section that tells Apache to feed .rbx > files in the cgi directory to mod_ruby? > > The config for one of my setups, where I use a separate directory for > all things .rb[x]-like is: > > > RubyRequire apache/ruby-debug > RubyTimeOut 60 > #Execute files under /ruby as Ruby scripts > > SetHandler ruby-object > RubyHandler Apache::RubyDebug.instance > RubySafeLevel 2 > Options ExecCGI > > > > ...but this is on Apache 1.3.29. > > -- > (\[ Kent Dahl ]/)_ _~_ _____[ http://www.pvv.org/~kentda/ ]_____/~ > ))\_student_/(( \__d L b__/ Master of Science in Technology ) > ( \__\_�|�_/__/ ) _) Industrial economics and technology management ( > \____/_�_\____/ (____engineering.discipline_=_Computer::Technology___) >