From: ES Date: 2005-05-22T10:16:06+09:00 Subject: Re: Ruby and CGI error 500 Le 21/5/2005, "greyfade@gmail.com" a �crit: >this is a problem that's been driving me nuts ever since i first tried >it. > >i can create simple, minimal scripts in Python, Perl, and PHP that run >flawlessly on the first try with minimal effort, both on my local >testing system (Apache 2.0.52 and Ruby 1.8.2) and on the server my >personal site is hosted on (Apache 1.3.33 and unknown version of Ruby - >i'm trying to find out). but no matter what i try, i simply can not >get even the most minimal ruby script to function: > >#!/usr/bin/env ruby > >print "Content-type: text/html\n\n" >print "Hello World!\n" > >it runs perfectly fine at the console, no warnings, no errors, no >problems. but as a CGI script, it's another story: i get an error 500 >and the cryptic (and seemingly common) "Premature end of script >headers". no other warnings or errors. if i simply change "ruby" to >"python" on the shebang line, the above script magically works with no >other effort on my part. This, actually, goes to the HTTP spec. Try this: #!/bin/env/ ruby print "HTTP/1.0 200 OK\r\n" print "Content-type: text/html\r\n\r\n" print "Hello World!\n" >i'm going insane because nothing, AFAICT, is wrong. the server is >correctly set-up, permissions are correct, ownership is correct, ruby >is installed and working, yet NOTHING seems to coax it into working. >it repeatedly reports this incredibly uninformative "Premature end of >script headers" error. > >is there something i could have missed? a possible misconfiguration? >or does ruby just hate me? E -- template void quack(duck& d) { d.quack(); }