apache2.2 and ruby script

L

Li Chen

Hi guys,

Before I post the question I already search the forum about how to
configure apache 2.2( under xp) to run Ruby script. I find one previous
post and follow it: 1) add line #!c:/Ruby/bin/ruby.exe -w at the start
of the script 2) change the file extension as .cgi 3) add a line
AddHandler cgi-script .cgi .pl in httpd.conf file. (No problem to run
the perl script)

####cgi1.cgi

#!c:/Ruby/bin/ruby.exe -w
print "HTTP/1.0 200 OK\r\n"
print "Content-type: text/html\r\n\r\n"
print "<html><body>Hello World!</body></html>\r\n"

####
I can run the script from prompt window and get the following output


C:\Program Files\Apache Software Foundation\Apache2.2\cgi-bin>ruby
cgi1.cgi
HTTP/1.0 200 OK
Content-type: text/html

<html><body>Hello World!</body></html>

But I can't run it from the IE browser. How can I fix it?

Thanks,

Li
 
L

Li Chen

Paul said:
Try this as a first line:

#!C:\Ruby\bin\ruby.exe -w

Remove this line (Apache provides it):

print "HTTP/1.0 200 OK\r\n"

See if that works.

Hi Paul,

After I remove this line

print "HTTP/1.0 200 OK\r\n"

from my script I can run the script from browser.

Thanks,

Li
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,813
Messages
2,569,699
Members
45,489
Latest member
SwethaJ

Latest Threads

Top