[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: CGI Error



I took his script, just as it was posted earlier, and installed it
on my machine here.  It ran flawlessly as a CGI program and gave me
the thankyou notice (the script was posted a couple of days ago).  

I sent him the same script I made, and it doesn't work on his
system, I am using perl5.003, and Apache 1.1.3 (Debian/GNU).  He
also had the permissions the same as I had mine set on my working
script.

The perl script doesn't call any 'helper' modules (CGI, etc.), so I
am at a loss as to why it isn't working.

Do other perl scripts function on the system?

Here is the actual script I used:

-----BEGIN err.pl--------------
#!/usr/bin/perl
read(STDIN,$temp,$ENV{'CONTENT_LENGTH'});
@pairs=split(/&/,$temp);
foreach $item(@pairs)
 {
  ($key,$content)=split(/=/,$item,2);
  $content=~tr/+/ /;
  $content=~s/%(..)/pack("c",hex($1))/ge;
  $fields{$key}=$content;
 }                                       
print "Content-type: text/html\n\n"; 
print "<HTML>\n";
print "<BODY BGCOLOR=#FFFFFF>\n";
print "<CENTER>\n";
print "THANK YOU<BR>\n";
print "$fields{fname} $fields{lname}</BR>";
print "I will write<BR>\n";
print "you at<BR>\n";
print "$fields{email}<BR>\n";
print "</CENTER>\n";
print "</BODY></HTML>";

----------END err.pl---------------------

Hamish Moffatt wrote:
> 
> On Sun, Dec 07, 1997 at 05:19:01PM -0500, Paul Miller wrote:
> > hmmm... that means something is wrong with Apache, suEXEC, or Perl 5.004.
> > Do I need any special perl libs/files for cgi?
> >
> > I've been able to run files which use sh (bash) and awk fine.. so I think
> > there is something wrong w/ perl.
> 
> Not at all. Just because it runs from the command line doesn't mean
> that everything that comes out is okay by Apache. That's what the message
> in your server error log saying "premature end of script headers" means.
> When you run the script from the command line, make sure the VERY FIRST THING
> THAT IS OUTPUT is
> 
> Content-type: text/html
> <blank line>
> <web page>
> 
> (Or text/plain, or whatever.)
> 
> It must be the very first thing, and it must come out. No blank lines before it,
> one blank line after the content-type.
> 
> Hamish
> --
> Hamish Moffatt, hamish@debian.org, hamish@rising.com.au, hmoffatt@mail.com
> Latest Debian packages at ftp://ftp.rising.com.au/pub/hamish. PGP#EFA6B9D5
> CCs of replies from mailing lists are welcome.   http://hamish.home.ml.org
> 
> --
> TO UNSUBSCRIBE FROM THIS MAILING LIST: e-mail the word "unsubscribe" to
> debian-user-request@lists.debian.org .
> Trouble?  e-mail to templin@bucknell.edu .


--
TO UNSUBSCRIBE FROM THIS MAILING LIST: e-mail the word "unsubscribe" to
debian-user-request@lists.debian.org . 
Trouble?  e-mail to templin@bucknell.edu .


Reply to: