PDA

View Full Version : Stupid Perl question


skids234
02-28-2007, 04:19 PM
I think I must be doing something incredibly stupid, and I'm looking for a little bit of guidance.

I've placed a file caled hello.pl into my cgi-bin. If I ssh in and do 'perl hello.pl' it outputs with no problems. However, if I try to execute it either directly via a url, or through an SSI, I get no ouput at all. No errors, no warnings. Just nothing. I thought it might be permissions related, but it's definitely set to 755. Please help!

The contents of hello.pl:

#!/usr/bin/perl

print "Content-type: text/html\n\n";
print "<html><head>";
print "<title>CGI Test</title>";
print "</head>";
print "<body><h2>Hello I am Perl</h2>";
print "</body></html>";

Matt
02-28-2007, 07:12 PM
See http://guide.apisnetworks.com/index.php/Suexec If your answer isn't contained in there, then what is your domain in question?

skids234
03-01-2007, 02:09 AM
Should have mentioned that I read through that already, but didn't shed any light on the problem.

Domain is alibaabaa.co.uk.

hello.pl is the only thing in my cgi-bin.

Matt
03-01-2007, 02:10 AM
Run dos2unix on the file. You can't execute it from the shell because the EOL marker is \r\n (CRLF, Windows-style):

[skids234@image cgi-bin]$ ./hello.pl
: bad interpreter: No such file or directory

That is how suexec executes the file.

skids234
03-01-2007, 02:18 AM
Damn, I've had trouble with my line endings before. That sorted it though. Thanks for the know-how.