Halo, everyone..I have this problem. When i run Perl / CGI on Windows platform, it worked fine. But when I migrate the source code to Linux server, it seemed to have problem, and it gave the error:
Server error!
The server encountered an internal error and was unable to complete your request.
Error message:
Premature end of script headers: student_validation.cgi
If you think this is a server error, please contact the webmaster
I do not know what this problem means. And my source code is as below:
#!/usr/bin/perl
use strict;
use DBI;
use CGI qw(:standard);
use CGI::Carp qw(fatalsToBrowser);
use lib qw(.);
print "Content-type: text/html\n\n";
my $student_password = param('student_password');
# sets the environment variable to an empty string
$ENV{PATH} = '';
# declares a scalar variable named $begin_at and sets it value that is passed from the HTML form
my $begin_at = param('begin_at') || 0;
# declares a scalar variables named $numdisplay and sets it to 10
my $numdisplay = 10;
# declares a scalar variable named $begin_at and sets it value that is passed from the HTML form
my $begin_at = param('begin_at') || 0;
# declares a scalar variables named $numdisplay and sets it to 10
my $numdisplay = 10;
# declares a hash named %bulletin and makes sure it is empty (to store bulletins)
my %bulletin = ();
# uses the param function to read the value passed in
my $action = param('form_action');
# open up the database handle to connect to the database
my $DB_Handle = DBI->connect("DBI:mysql:upsr","","") or die ("Cannot connect: $DBI::errstr\nAborting");
#my $login = param('login');
#my $password = param('password');
#my ($sth_question) = Get_Question($DB_Handle, $begin_at, $numdisplay);
#my ($question_id, $question_instruction, $question, $ans_A, $ans_B, $ans_C, $ans_D, $notes);
#$sth_question->bind_columns(\($question_id, $question_instruction, $question, $ans_A, $ans_B, $ans_C, $ans_D, $notes));
print header();
#my $stu_login = cookie("student");
#my $query = CGI->new();
#my $cookie = $query->cookie(-name => 'student',
# -value=> $stu_login,
# -expires => '+3d',
# -path=>'/cgi-bin/upsr',
# -domain=>'http://61.6.67.118'); # the cookie is three days valid
#print $query->header(-cookie => $cookie);
PLEASE ADVISE...IM STUCKED