Results 1 to 5 of 5
  1. #1
    Join Date
    Mar 2004
    Location
    Malaysia
    Posts
    29

    Angry Unanswered: Windows to Linux ?

    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

  2. #2
    Join Date
    Jan 2004
    Location
    Germany
    Posts
    167
    you're trying to print the header two times. delete the line "print header();".
    board.perl-community.de - The German Perl-Community

  3. #3
    Join Date
    Mar 2004
    Location
    Malaysia
    Posts
    29

    i have tried

    i have deleted the print header();
    but still cannot work...i really dont know how coz im not familiar with Linux...please HELP...

  4. #4
    Join Date
    Jan 2004
    Location
    Germany
    Posts
    167
    Are you able to look at the server's configuration?
    Is .cgi an allowed extension for CGI-Skripts?
    Is perl lying in /usr/bin/ ?

    This error message suggests that something is printed before the header...

    Can you look at the error.log ?
    There are more information than in the browser...
    board.perl-community.de - The German Perl-Community

  5. #5
    Join Date
    Mar 2004
    Location
    Malaysia
    Posts
    29

    Unhappy checked

    yes, i have checked the server config...and it allowed .cgi and .pl
    the problem is that only that particular page that could not work...others cgi script work fine...i mean the connection...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •