Pergunta

I try to execute a simple perl script on my server and I get an internal 500 server and when I check the error logs it shows:

Premature end of script headers: test.pl

Here is the perl script:

#!/usr/bin/perl -w
print "Content-type: text/plain\n\n";
print "testing...\n";

My cgi-bin folder has permissions of 0755. The script itself is also 0755. The script is owned by apache and its in the group apache. The script works fine via the command line.

What is the problem and how can I fix this?!

Thanks all for any help!

Update

Interesting find in suExec:

2010-09-14 17:38:28]: uid: (10001/som) gid: (2522/2522) cmd: test.pl
[2010-09-14 17:38:28]: target uid/gid (10001/2522 or 2521) mismatch with directory (48/0) or program (48/0)

But my cgi-folder is the same as the test.pl script - is it referring to another directory?

Foi útil?

Solução

There are a lot of good troubleshooting suggestions for Perl scripts giving that error message on PerlMonks: start here. I don't see any specific errors in your script, and it looks like you've covered the file permissions, so I'd start with the Apache configuration suggestions.

Outras dicas

Plenty of good advice: How can I troubleshoot my Perl CGI script.

Update having seen your suexec error message: Looks like your server needs the CGI program to be owned by the same user as the directory. Try changing the ownership of the file.

Use CGI module e.g.

use CGI qw/:standard/;
$q = CGI->new;
print $q->header('text/html');
print "testing...\n";     
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top