Premature end of script headers / Internal Server Error
Posted on 2005-05-17
We have a site using Perl which began giving the Internal Server Error. It consists of two pages. The first is a login page called "login". The second is a ordering page called "order". I'm not too familiar with Perl so I'm hoping to get some info to clear up this error.
We first open the login page domain.com/cgi-bin/login and looking at the error logs it gives the error:
Use of uninitialized value in concatenation (.) or string at login line 22.
Here is the code from that page with line numbers and comments/line spaces removed:
1: #!/usr/bin/perl -w
8: use CGI;
9: $q = new CGI;
14: my $order_cgi = "http://domain.com/cgi-bin/order";
17: my $errstr = "<h2>Invalid username or password</h2>" if $q->param('ERROR');
20: print $q->header;
22: print <<"EOF"
.... etc, etc..
On the login page we enter a username/password, click enter and the ordering page is loaded which is at domain.com/cgi-bin/order. This page doesn't load but instead comes up with the classic Internal Server Error. looking at the error logs it shows:
[Tue May 17 12:22:41 2005] [error] [client my.ip.here] Premature end of script headers: /home/httpd/vhosts/domain.com/cgi-bin/order
Here is the first part of the code up to the end of the headers:
$Username => ""
my $dbh = DBI->connect("DBI:CSV:f_dir=/home/rhaynes/db")
|| die "Cannot connect: " . $DBI::errstr;
my $sth = $dbh->prepare("select * from robin where Username=?");
my @row = $sth->fetchrow_array();
a whole bunch of variable initialized with:
and some functions
What would be causing these errors?