PDA

View Full Version : Internal Server Error


mswanndeford
02-13-2007, 09:24 PM
I am just learning CGI/Perl and I am trying to test a very basic script. However, I keep getting an Internal Server Error.

Can anyone help? :confused:

Script:
#!/usr/perl/bin/perl.exe

use strict;
use CGI ':standard';

my $value;

$value = param('tapas');

print "Content-type: text/html\n\n";
print "Your favorite Tapas place in Barcelona was $value";

HTML:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Untitled Document</title>


</head>

<body>
<form action="tapas.cgi" method="post">
What's the name of your favorite Tapas place in Barcelona?<br>
<input type="text" size="20" name="tapas"><br>
<input type="submit"></form>
</body>
</html>

KevinADC
02-13-2007, 10:59 PM
first thing to check is if this is correct:

#!/usr/perl/bin/perl.exe


try:

#!/usr/bin/perl

or if on windows::

#!C:/perl/bin/perl.exe

mswanndeford
02-13-2007, 11:50 PM
Hi Kevin, thanks. Here's the thing I am using an external development server to test my scripts. I access it using the ip address.

An interesting point: there is a cgi-bin folder, but when the scripts are placed in this folder, I get the page cannot be located error, but when I put the script in another folder, I get the Internal Server Error.

So, what should my path be? Do I need an absolute path or a relative path?

On the dev server, the perl app is located in perl/bin/perl.exe.

Thanks for your help!

KevinADC
02-14-2007, 02:54 AM
also in your for you have:

<form action="tapas.cgi" method="post">

that only works if the html page is in the cgi-bin (or the same folder as the script). If the html page is in the root www folder and the cgi-bin folder is a sub folder of the www (root) folder, you can do this:

<form action="cgi-bin/tapas.cgi" method="post">

as far as the correct path to perl to use you need to figure that out or ask tech support if there is anyone to ask, but you can always try different ones until you hit on the right one

#!/usr/bin/perl
#!/usr/local/bin/perl
#!c:/perl/bin/perl

etc
etc
etc

mswanndeford
02-14-2007, 04:41 PM
Hi Kevin. Yes, my html file is in the same folder.

I have tried all the path variations...I am stumped.

Thanks for your help!

KevinADC
02-14-2007, 07:07 PM
ask tech support?

mswanndeford
02-15-2007, 06:30 PM
Unfortunately, we don't have anyone here that can answer my questions...very frustrating. Thanks!

KevinADC
02-15-2007, 07:07 PM
looks like it should work....

make sure to upload the perl file in ASCII (text) mode and set filepermissions (chmod) to 755. Look in the help files of your FTP program f you don't know how to do that:

transfer mode
chmod

cgibie
02-15-2007, 10:51 PM
What webhost service you have? Maybe try to go to their FAQ section. It should tell you that.