Perl?

pzelnip

New Member
Messages
2
Reaction score
0
Points
0
Okay, how do you get Perl working on here? I've uploaded about the simplest Perl script I can create, threw it into my cgi-bin directory, and changed the permissions to 755.

I still get 500 Internal Server Error.

My code is:

#!/usr/bin/perl
use CGI;
use CGI::Carp qw(fatalsToBrowser);

# create a new CGI object to handle this request
$q = new CGI;

# display standard HTML header stuff

print $q->header,
$q->start_html('Echo CGI'),
$q->h1('Echo CGI');

# get a list of all parameters (fields) passed to us
@names = $q->param;

# now display a DL with params and values
print "<HR>";
print "<DL>";

# loop over all the param names (sorted)
# displaying each name and associated value
foreach $n (sort @names) {
print "<DT><B>$n</B>";
print "<DD>", $q->param("$n");
}

print "</DL>";
print "<HR>";

# the HTML trailers
print $q->end_html;

# end

Which should be able to be run at:

http://pzelnip.x10hosting.com/cgi-bin/echo.cgi?test=20
 
Last edited:

misson

Community Paragon
Community Support
Messages
2,572
Reaction score
72
Points
48
Your script works for me on Absolut. Perhaps there's something wrong with the server configuration, either host-wide or something in your root .htaccess. What are the permissions for cgi-bin? Is there anything in your error log?

Try something even simpler:
Code:
#!/usr/bin/env perl
print "Content-type: text/plain\n\n"
print "Success?\n"
 

pzelnip

New Member
Messages
2
Reaction score
0
Points
0
Your script works for me on Absolut. Perhaps there's something wrong with the server configuration, either host-wide or something in your root .htaccess. What are the permissions for cgi-bin? Is there anything in your error log?

Okay now the echo script works. Apparently when I changed the permissions they didn't stick as somehow they were reset to 644.

Now my problem is the other script which is in my cgi-bin directory isn't working.

Looking at the raw error logs, I see:

[28/May/2009:18:33:36 -0500] "POST /cgi-bin/mail_form.cgi HTTP/1.1" 404 - "http://pzelnip.x10hosting.com/feedback.html" "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.10) Gecko/2009042316 Firefox/3.0.10"

Why there would be a 404 error is beyond me though. The feedback.html file comes up fine, but the script it calls upon isn't working (and I know the script is valid as I have it hosted elsewhere and it works fine).

Edit: and your script had the same problem. Uploaded it, gave it 755 for permissions, and same error.
 
Last edited:

xav0989

Community Public Relation
Community Support
Messages
4,467
Reaction score
95
Points
0
how can a regular static html file can call some server side cgi?
 

misson

Community Paragon
Community Support
Messages
2,572
Reaction score
72
Points
48
Okay now the echo script works. Apparently when I changed the permissions they didn't stick as somehow they were reset to 644.
FTP clients may change the permissions of an uploaded file to match the local version, even if the local filesystem doesn't use Unix style permissions.

Now my problem is the other script which is in my cgi-bin directory isn't working.

Looking at the raw error logs, I see:

[28/May/2009:18:33:36 -0500] "POST /cgi-bin/mail_form.cgi HTTP/1.1" 404 - "http://pzelnip.x10hosting.com/feedback.html" "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.10) Gecko/2009042316 Firefox/3.0.10"

Why there would be a 404 error is beyond me though.
Considering the error page resulting from mail_form.cgi says "Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request", the 404 error in the log is probably because there's an error document directive (either in the virtual host configuration or the root .htaccess) that refers to a nonexistent file. Something like:
Code:
ErrorDocument 500 /500.html
The 404 is harmless. If it really bugs you, you can always create a custom error page.

The feedback.html file comes up fine, but the script it calls upon isn't working (and I know the script is valid as I have it hosted elsewhere and it works fine).

Edit: and your script had the same problem. Uploaded it, gave it 755 for permissions, and same error.
Hmmm.... Does mail_form.cgi send fatal errors to the browser? If something like the following produces a 500 error, you know the script isn't even being executed.

Code:
#!/usr/bin/perl
use CGI;
use CGI::Carp qw(fatalsToBrowser);

print CGI::header(-type => 'text/html');

print "Success?"

Also, make sure your browser isn't loading the cached error page.
 
Top