Can't Get mod_ruby to Work in Apache 2.0.47
"Mark Wilmoth" <[email protected]>
| Newsgroups | gmane.comp.apache.mod-ruby |
|---|---|
| Message-ID | <002b01c40237$e69afbb0$0200a8c0@rome> |
Hi everyone,
I dabble a bit in vbscript and ASP and have wanted to switch to something
using Apache & Linux. I saw some people mentioning Ruby and read about it
and mod_ruby and thought I would give it a try.
Anyway I have:
Mandrake Linux 9.2
Apache 1.3.28
Apache 2.0.47
mod_ruby 1.0.7
eruby 1.0.5
-----
eruby works on both versions of Apache.
On Apache 1.3.28, mod_ruby works, but when I try to use cgi.rb in a script
like this:
require 'cgi'
cgi = CGI.new
print cgi.header['type'=>'text/html']
I get this error:
[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'
-----
On Apache 2.0.47, mod_ruby doesn't work with my /ruby/rubytest.rbx file...
it just loads like a regular text file.
Here is the content of rubytext.rbx:
print "HTTP/1.1 200 OK\r\n"
print "Content-type: text/html\r\n\r\n"
print "<!DOCTYPE HTML PUBLIC '-//W3C/DTD HTML 4.01 Transitional//EN'>"
print "<html>
<head>
<title>eRuby Test!</title>
<meta http-equiv='Content-Type' content='text/html;
charset=iso-8859-1'>
</head>
<body>
<h1>" 1.upto(10) do |x|
print " Hello Ruby!<br>\n"
end
print " </h1>
</body>
</html>\n"
-----
Here is what I added to httpd2.conf for Apache 2.0.47
LoadModule ruby_module modules/mod_ruby.so
<IfModule mod_alias.c>
ScriptAlias /ruby/ /var/www/ruby/
</IfModule>
<Directory /var/www/ruby>
AllowOverride All
Options ExecCGI
<IfModule mod_access.c>
Order allow,deny
Allow from all
</IfModule>
</Directory>
<IfModule mod_ruby.c>
RubyRequire apache/ruby-run
<Location /ruby/*.rbx>
SetHandler ruby-object
RubyHandler Apache::RubyRun.instance
#Options ExecCGI #This directive already used above.
</Location>
RubyRequire apache/eruby-run
<Location /*.rhtml>
SetHandler ruby-object
RubyHandler Apache::ERubyRun.instance
</Location>
</IfModule>
-----
Any help would be appreciated.
Thanks,
Mark