Welcome to the dBforums forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions, articles and access our other FREE features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload your own photos and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact contact support.

If you prefer not to see double-underlined words and corresponding ads, place your cursor
here for ContentLink opt out.

Go Back  dBforums > Data Access, Manipulation & Batch Languages > Perl and the DBI > Windows to Linux ?

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 06-24-04, 01:57
stevencl2000 stevencl2000 is offline
Registered User
 
Join Date: Mar 2004
Location: Malaysia
Posts: 29
Angry 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
Reply With Quote
  #2 (permalink)  
Old 06-24-04, 08:16
reneeb reneeb is offline
Registered User
 
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
Reply With Quote
  #3 (permalink)  
Old 06-24-04, 22:36
stevencl2000 stevencl2000 is offline
Registered User
 
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...
Reply With Quote
  #4 (permalink)  
Old 06-25-04, 02:48
reneeb reneeb is offline
Registered User
 
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
Reply With Quote
  #5 (permalink)  
Old 06-25-04, 06:39
stevencl2000 stevencl2000 is offline
Registered User
 
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...
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On