On 6/28/07, Gale CC <galecho / gmail.com> wrote:
> I'm a newbie to both Ruby and Ajax. I'm trying to use Ruby to handle the
> server side of an Ajax application, but the script doesnt run and
> instead of the output the source code shows up. I'm running these
> scripts on Apache. I've made sure that the script is executable but its
> still not running. Any help with this would be greatly appreciated. I've
> tried Googling for this problem but didnt get any helpful results. My
> source code looks as follows:

Try renaming the script to test2.cgi and see if that helps.
If you don't want to then you need to define .rb as a script in the
Apache config file and restart Apache. Can't recall the exact syntax
here, so try searching for cgi and see if it can be used.

>
> ruby script(test2.rb):
>
> response = Time.now
> puts response

This line will give an error in your Apache log.
What you need to output here is some kind of header info. Not sure
what exactly needs to be present here but try:

puts "Content-type: text/html"
puts response


-- 
J-H Johansen
--
There are 10 kinds of people in the world: Those who understand binary and
those who don't...