From: shiwei zhang Date: 2006-11-08T18:18:49+09:00 Subject: Ruby Cgi Puzzle on Apache ------=_Part_22144_7875294.1162977520132 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline 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 ------=_Part_22144_7875294.1162977520132--