From: John Feezell
Date: 2003-07-01T01:59:08+09:00
Subject: Re: rbx wtih Apache 2
Here is a listing of a test file I use.
Note I had to mod .htaccess to include: AddHandler cgi-script rbx
-----------------------
#!/mypath/to/bin/ruby # This is a properly working ruby script running ruby
script with extension .rbx
# If the key for ENV does not exist, then ruby returns nil.
# It required the following modification to .htaccess in www
# AddHandler cgi-script rbx
#
require 'date'
print "Content-type: text/html\n\n"
d = Date.new(2000, 3, 31)
#print $:,'
'
print ENV['RUBYPATH'],''
print [d.year, d.yday, d.wday]
print "this is a test.", ENV['PATH'], "prefix= ",ENV['prefix'],"
"
names = ["john", "mary", "", 4]
data = [1, 2, 3, 4]
data.each do |i |
print i, " ", names[i-1],"
"
end
print "Environment variables
" ENV.keys.sort.each do |key|
print "| ",key," | ", ENV[key], " | "
print "
"
end
print "
"
-----------------------
On Mon, 30 Jun 2003 14:43:57 +0900, Barrow H Kwan
wrote:
> I have tested Ruby ( with rbx rather than rhtml ) with Apache2 without
> any luck.
>
> I got the following error in Apache log when I hit
> http:///test.rbx
>
> [Sun Jun 29 22:28:15 2003] [error] mod_ruby: error in ruby
> (eval): uninitialized constant Ruby at Apache (NameError)
> from ruby:0:in `value'
>
>
> and here is my test.rbx
> #!/export/opt/ruby/ruby-1.6.8/bin/ruby
>
> print "HTTP/1.0 200 OK\r\n"
> print "Content-type: text/html\r\n\r\n"
> print "Hello World!\r\n"
>
>
> any help will be appreciated!
>
> thanks
>
> Barrow
--