From: mycorner6@... (Michele)
Date: 2002-03-14T21:46:14+09:00
Subject: Problems with Ruby, apache, and cgi
I'm a systems admin for a webhosting company. We had a request for
ruby for one of the websites, and agreed to install ruby, but not
mod_ruby because of the memory leak issue with apache.
The client seems to feel his programs will only work with mod_ruby.
We put up a test script to ensure ruby worked from within apache, a
simple hello world:
#!/usr/local/bin/ruby
print "Content-type: text/html\r\n\r\n"
print "
Hello SAm and Lisa!!!!\r\n"
This runs successfully when going to /cgi-bin/test.rb
However, when the client tries a more complicated script:
#!/usr/local/bin/ruby
class Hello
attr_reader :msg
def initialize
@msg = "Hello, World"
end
end
h = Hello.new
puts h.msg
print "Press RETURN"
$stdin.gets
This fails. Note I can run the first script at the command line by
simply typing ./test.rb, but the 2nd one fails with the same error as
the website:
../hello.rb
../hello.rb: Command not found.
If i run /usr/local/bin/ruby hello.rb, it runs successfully.
I guess my question is are there things that mod_ruby can do that a
regular ruby script can't? My reading at the mod_ruby site implies
that it simply speeds it up, but that it doesn't add functionality.
Is there something wrong with my client's program? Any suggestions on
how to make this work without mod_ruby?
Thanks.
-Michele