Since you mention being new to cgi, and have doning some php, I'm guessing you aren't using the ruby script in the right directory, or using the right url to call it, or are missing some boilerplate.
Ruby and php are not directly equivalent. If you've only installed ruby, you need to put the ruby script into your cgi-bin directory, since cgi is how you would call it.
e.g.
http://localhost/cgi-bin/test.rb
would be the right url for a file in the apache cgi-bin directory.
Also, you may need to put some http boilerplate.
test.rb
···
======
#!/usr/local/bin/ruby
print "Content-type: text/html\r\n\r\n"
print "hello"
On Apache on OS X, I need the second line for it to work. The first line is Unix specific, and won't apply to Windows.
There is also a cgi module to help with many common cgi tasks that you can look at.
If you want to use ruby in the same way as Php, you need to install mod_ruby and eruby:
modruby.net
Then you can create files like index.rhtml, and use embedded ruby code, much like how php works. This may be your best starting point if you like the php method.
Or install a web framework like rails, iowa, arrow, etc, and follow their conventions.
Regards,
Nick
coke wrote:
I'm very new to cgi and have no background of programming other than a
little php editing and that's it.After seeing hugh's message I went
back to the test script and looked for typos and surly there was one.I
corrected the typo and everything worked fine,thanks for the replys.
On Wed, 1 Dec 2004 06:37:56 +0900, Neil Stevens <neil@hakubi.us> wrote:
On Wed, 01 Dec 2004 02:53:24 +0900, coke wrote:
I came across Ruby about 33 hours and decided to take it up.I have
exp. with apache,php and such but no cgi,perl or anything close to
ruby.I've configured my apache(ver. 1.3.31) for ruby.When I type the
address of the .rb file into my broswer I get an 500 Internal error,I
have no clue and can't find anything on it.
Specs:
Windows 98
Apache 1.3.31
Ruby 1.8
Check your Apache error log after seeing the 500 error to see what's wrong
with the ruby you're attempting to run.
--
Neil Stevens - neil@hakubi.us
"The world is a dangerous place to live; not because of the people who
are evil, but because of the people who don't do anything about it."
-- Albert Einstein(?)