From: Pat Eyler Date: 2002-05-11T06:14:12+09:00 Subject: Re: Premature end of script headers On Sat, 11 May 2002, ccos wrote: > hey there, > thanks for the speedy reply. > i tried usr/local/bin/ruby > and nothing. Can you run the scripts from the command line? [pate@gnupate scratch]$ for i in cgi*; do > echo $i > echo ===file====== > cat $i > echo ===output==== > ./$i > echo ============= > done cgi.pl ===file====== #!/usr/bin/perl print "Content-type: text/html\r\n\r\n"; print "Hello, World.\r\n"; ===output==== Content-type: text/html Hello, World. ============= cgi.rb ===file====== #!/usr/local/bin/ruby print "Content-type: text/html\r\n\r\n" print "Hello World!\r\n" ===output==== Content-type: text/html Hello World! ============= the scripts themselves look fine -pate > i also tried running a perl script from usr/bin/perl > and i get the same error: > > > #!/usr/bin/perl > print "Content-type: text/html\r\n\r\n"; > print "Hello, World."; > > what do you think? > regards, > c > On Saturday, May 11, 2002, at 06:24 AM, Pat Eyler wrote: > > > On Sat, 11 May 2002, Pat Eyler wrote: > > > >> On Sat, 11 May 2002, ccos wrote: > >> > >>> hello, > >>> i'm new to ruby, unix, apache, and cgi, so i feel like i'm wrestling a > >>> four headed dragon, well more like wrestling a three headed dragon and > >>> patting a friendly goat. > >>> i keep getting: > >>> Premature end of script headers: /Library/WebServer/CGI- > >>> Executables/cgiTrial2.cgi > >>> in my apache error log. > >>> im running os x with Marc Liyanage's distro, freshly installed. > >>> i don't think it's not a permissions problem, the file is chmod 755'd. > >>> my file is called cgiTrial2.cgi and contains: > >>> > > > > doh! I should have seen this before I sent the mail > > > >>> #!/usr/local/bin ruby << i think this is right? > > #!/usr/local/bin/ruby #assuming ruby is in /usr/local/bin > > > >>> > >>> print "HTTP/1.0 200 OK\r\n" > >>> print "Content-type: text/html\r\n\r\n" > >>> print "Hello World!\r\n" > >>> > >>> this is saved as an asci file w/ unix breaks. > >>> any ideas? > >> > >> what happens when you run the script from the command line? > >> > > > > > > -pate > > > >> -pate > >> > >> > >>> thanks much, > >>> _c > >>> > >> > >> > > > >