I am totally new to UNIX, LINUX, Apache and CGI. This is the first time I left the<br>
comfort of Cold Fusion on NT...<br>
<br>
WHAT I DID...<br>
I wrote a Perl script that allows the user to add links to a page from<br>
another (data entry) page.<br>
<br>
THE PROBLEM...<br>
When the user presses the submit button the page DOES update with the new<br>
link, but instead of giving a thank you message I get a Internal Server<br>
Error with no number.<br>
<br>
I KNOW IT's NOT THE PERL SCRIPT (OR DO I)...<br>
I talked to the Internet provider and they agree that the perl script works<br>
but they are not sure why we are getting a server error. I suggested that<br>
the server (Apache) or the OS (LINUX) needed to be configured differently<br>
but the provider doesn't think so since they are not having problems<br>
elsewhere (Good Point).<br>
<br>
SECURITY? NOT IN THIS CASE...<br>
I set all files and directories to 777, 666, and tried some others. Besides<br>
the script does update the page, it's after the page updates that I get<br>
this error.<br>
<br>
It seems that maybe I need to tell the server where to go when it's done<br>
updating the page.<br>
But I checked other perl CGI scripts and they never seem to have anything<br>
other then a print statement with HTML at the end of the process just like<br>
my script.<br>
<br>
THIS IS THE PERL SCRIPT... (second.pl)<br>
#!/usr/bin/perl<br>
<br>
# get form input, split each form field into @pairs array<br>
read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});<br>
@pairs = split(/&/, $buffer);<br>
<br>
# clean up each array element<br>
foreach $pair (@pairs) {<br>
($name, $value) = split(/=/, $pair);<br>
$value =~ tr/+/ /;<br>
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;<br>
$value =~ s/\n/ /g; # replace newlines with spaces<br>
$value =~ s/\r//g; # remove hard returns<br>
$value =~ s/\cM//g; # delete ^M's<br>
$FORM{$name} = $value;<br>
}<br>
<br>
# add links to this file<br>
$out = "../test/edit/LegalPicks.html";<br>
<br>
# open file for append, add links<br>
open(OUT, ">>$out"
;<br>
<br>
# This locks the file so no other CGI can write to it at the <br>
# same time...<br>
flock(OUTF,2);<br>
<br>
# Reset the file pointer to the end of the file, in case <br>
# someone wrote to it while we waited for the lock...<br>
seek(OUTF,0,2);<br>
<br>
print OUT 'Other Stuff99'."\n";<br>
print OUT "<a href=\"<A HREF=" TARGET="_new"><br>
close OUT;<br>
<br>
print <<EndHTML;<br>
content-type text/html<br>
<html><head><title>Thank You</title></head><br>
<body><br>
<h2>Thank You!</h2><br>
Thank you for your feedback.<p><br>
<a href="index.html">Return to our home page</a><p><br>
</body></html><br>
EndHTML<br>
<br>
<br>
THIS IS THE DATA ENTRY PAGE...<br>
<br>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><br>
<br>
<html><br>
<head><br>
<title> Add Links Form</title><br>
</head><br>
<br>
<body><br>
<br>
<form method="post" action="../../cgi-bin/second.pl"><br>
<br>
<table><br>
<tr><br>
<td>Type</td><br>
<td><input type="text" size="40" maxlength="40"></td><br>
</tr><br>
<tr><br>
<td>URL</td><br>
<td><input type="text" size="40" maxlength="40"></td><br>
</tr><br>
<tr><br>
<td>Desc</td><br>
<td><textarea name="requiredMessage" wrap="VIRTUAL" rows="15" cols="50"></textarea></td><br>
</tr><br>
</table><br>
<input type="submit" name="addLink" value="AddLink"><br>
</form><br>
<br>
</body><br>
</html><br>
<br>
Any help would be great<br>
<br>
Thanks
comfort of Cold Fusion on NT...<br>
<br>
WHAT I DID...<br>
I wrote a Perl script that allows the user to add links to a page from<br>
another (data entry) page.<br>
<br>
THE PROBLEM...<br>
When the user presses the submit button the page DOES update with the new<br>
link, but instead of giving a thank you message I get a Internal Server<br>
Error with no number.<br>
<br>
I KNOW IT's NOT THE PERL SCRIPT (OR DO I)...<br>
I talked to the Internet provider and they agree that the perl script works<br>
but they are not sure why we are getting a server error. I suggested that<br>
the server (Apache) or the OS (LINUX) needed to be configured differently<br>
but the provider doesn't think so since they are not having problems<br>
elsewhere (Good Point).<br>
<br>
SECURITY? NOT IN THIS CASE...<br>
I set all files and directories to 777, 666, and tried some others. Besides<br>
the script does update the page, it's after the page updates that I get<br>
this error.<br>
<br>
It seems that maybe I need to tell the server where to go when it's done<br>
updating the page.<br>
But I checked other perl CGI scripts and they never seem to have anything<br>
other then a print statement with HTML at the end of the process just like<br>
my script.<br>
<br>
THIS IS THE PERL SCRIPT... (second.pl)<br>
#!/usr/bin/perl<br>
<br>
# get form input, split each form field into @pairs array<br>
read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});<br>
@pairs = split(/&/, $buffer);<br>
<br>
# clean up each array element<br>
foreach $pair (@pairs) {<br>
($name, $value) = split(/=/, $pair);<br>
$value =~ tr/+/ /;<br>
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;<br>
$value =~ s/\n/ /g; # replace newlines with spaces<br>
$value =~ s/\r//g; # remove hard returns<br>
$value =~ s/\cM//g; # delete ^M's<br>
$FORM{$name} = $value;<br>
}<br>
<br>
# add links to this file<br>
$out = "../test/edit/LegalPicks.html";<br>
<br>
# open file for append, add links<br>
open(OUT, ">>$out"
<br>
# This locks the file so no other CGI can write to it at the <br>
# same time...<br>
flock(OUTF,2);<br>
<br>
# Reset the file pointer to the end of the file, in case <br>
# someone wrote to it while we waited for the lock...<br>
seek(OUTF,0,2);<br>
<br>
print OUT 'Other Stuff99'."\n";<br>
print OUT "<a href=\"<A HREF=" TARGET="_new"><br>
close OUT;<br>
<br>
print <<EndHTML;<br>
content-type text/html<br>
<html><head><title>Thank You</title></head><br>
<body><br>
<h2>Thank You!</h2><br>
Thank you for your feedback.<p><br>
<a href="index.html">Return to our home page</a><p><br>
</body></html><br>
EndHTML<br>
<br>
<br>
THIS IS THE DATA ENTRY PAGE...<br>
<br>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><br>
<br>
<html><br>
<head><br>
<title> Add Links Form</title><br>
</head><br>
<br>
<body><br>
<br>
<form method="post" action="../../cgi-bin/second.pl"><br>
<br>
<table><br>
<tr><br>
<td>Type</td><br>
<td><input type="text" size="40" maxlength="40"></td><br>
</tr><br>
<tr><br>
<td>URL</td><br>
<td><input type="text" size="40" maxlength="40"></td><br>
</tr><br>
<tr><br>
<td>Desc</td><br>
<td><textarea name="requiredMessage" wrap="VIRTUAL" rows="15" cols="50"></textarea></td><br>
</tr><br>
</table><br>
<input type="submit" name="addLink" value="AddLink"><br>
</form><br>
<br>
</body><br>
</html><br>
<br>
Any help would be great<br>
<br>
Thanks