Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

script works on one server but not another? 1

Status
Not open for further replies.

random260

Programmer
Mar 11, 2002
116
US
OK, I'm confused. I have this perl script (see below) that works just fine on one server. But I just tried it on another and I get an error 500. The log file tells me "Premature end of script headers". Can someone tell me what is causing this please? Thanks, here is the script (I'll post the html below the script just in case that helps).

#!/usr/bin/perl5 -w

use strict;

use CGI qw:)all);

use CGI::Carp qw(fatalsToBrowser);



# use Fcntl qw:)flock);



sub send_mail {

my($to, $from, $subject, @details)=@_;

my $sendmail="/usr/sbin/sendmail -t -oi";

open(MAIL, "|$sendmail") || die "Can't start sendmail: $!";

print MAIL<<END_OF_HEADER;

from: $from

to: $to

subject: $subject


END_OF_HEADER


print MAIL "Tournament entry request\n\n";



my $name = param("name");

print MAIL "$name\n";



my $address = param("address");

print MAIL "$address\n";



my $city = param("city");

print MAIL "$city,";



my $state = param("state");

print MAIL "$state ";



my $zip = param("zip");

print MAIL "$zip\n";

my $phone = param("phone");

print MAIL "$phone\n";

my $email=param("return_addr");

print MAIL "$email\n\n";

print MAIL "Member?\n";

my $member = param("member");

print MAIL "$member\n\n";

print MAIL "Please enter me into the following tournament(s)\n";

my $event = param("event");

print MAIL "$event\n\n";



print MAIL "Additional comments\n\n";

foreach (@details) {

print MAIL "$_\n";

}

print MAIL "\n";



close(MAIL);

}



print header;

my $return=param("return_addr");

if (! defined $return or ! $return) {

print "You must supply an email address<P>";

exit;

}

my $subject=param("subject");

if (! defined $subject or ! $subject) {

print "You must supply an subject<P>";

exit;

}



send_mail('mymail@mydomain.net',

$return,

$subject,

param("body"));





print "Mail sent.";


SCRIPT ENDS HERE
HTML BEGINS HERE



<b><CENTER>Woodbury Golf Course tournament entry form</CENTER></b><BR><BR>

Please complete all fields of the form. Thank you.<br><br>
Full name:<BR>

<INPUT name=name>

<BR>

<BR>
Address:<BR>

<Input name=address>

<BR>

<BR>
City:<BR>

<Input name=city>

<BR>

<BR>
State:<BR>

<Input name=state>

<BR>

<BR>
Zip:<BR>

<Input name=zip>

<BR>

<BR>
Phone:<BR>

<Input name=phone>

<BR>

<BR>
Your e-mail address:<BR>

<INPUT name=return_addr>

<BR>

<BR>
Are you a member?:<BR>

<INPUT type=radio value=yes name=member>Yes

<INPUT type=radio value=no name=member>No

<BR>

<BR>

Subject:<BR>

<INPUT value="Tournament entry" name=subject>

<BR>

<BR>

I wish to register for:<BR>

<INPUT type=radio value=Scratch name=event>Scratch (September 10)

<INPUT type=radio value=Handicap name=event>Handicap (September 17)

<INPUT type=radio value=Both name=event>Both events

<BR>

<BR>





Please enter any additional information (including handicap if known and entering handicap event):<br>

<TEXTAREA name=details rows=10 wrap=hard cols=40></TEXTAREA>

<BR>

<BR>





<INPUT type=submit value=Send Message?> </FORM>
 
if there are no syntax errors, I would suspect the first line is the problem:

#!/usr/bin/perl5 -w


change to:

#!/usr/bin/perl -w


and see if that helps.

 
To expand on what Kevin's suggesting, the path to perl could be incorrect

if you have access to the command line
type "which perl" which will return the path to perl


Spend an hour a week on CPAN, helps cure all known programming ailments ;-)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top