Hi, All,
On my Linux machine, I configured Mod_fcgid.2.0 in Apache2.2.3.
And
I also installed ruby-1.8.5. Then I wrote two .rb files in the Apache
cgi-bin directory, as follows.
//////////////////////cgitest01.rb starts/////////////////////
#!/usr/local/bin/ruby
puts “”;
puts “nice prog!”;
//////////////////////cgitest01.rb ends//////////////////////
//////////////////////cgitest02.rb starts/////////////////////
#!/usr/local/bin/ruby
puts “nice prog!”;
//////////////////////cgitest02.rb ends/////////////////////
At this moment I visited
http://xx.yyy.com/cgi-bin/cgitest01.rb,
and it worked well. It printed out “nice prog!” normally.
However, when I visited
http://ts.cn.oracle.com/cgi-bin/cgitest02.rb, I got the following error:
[Wed Nov 08 17:18:26 2006] [error] [client 146.56.236.149] malformed
header
from script. Bad header=nice prog!: cgitest02.rb
Anybody can tell me why I encountered the error when visiting
cgitest02.rb?
Why must I put out an empty line (puts “” at the biginning of the file
if
I want to successfully visit it?
Many Thanks in advance!
Rgds,
Shiwei