PDA

View Full Version : Error: "Premature end of script headers" when running perl script


Swaysteady
03-17-2006, 08:48 PM
Hi all,
I'm hoping someone can give me a hand, I'm at my wit's end. All perl scripts that I'm running from my last host that I transferred to my new Rimu acount are bombing out with interneal server errors. The error on my log reads: "Premature end of script headers".

I put a stripped down script together that reads:

use CGI;
use strict;
use CGI::Carp qw(fatalsToBrowser);


my $cgi = CGI->new();
print $cgi->header('text/html');

print "<h1>Hello!</h1>";

and that's still bombing out. I'm thinking it's an environmental thing... I'm using the default mod_perl enabled setup for a domain, could that have something to do with it?

Other things to note:

1.) RHEL4 w/Plesk setup
2.) File is located at /var/www/vhosts/domain.com/cgi-bin/script.pl
3.) File owner is the same owner as all other files in the domain, same group as well.
4.) Permissions for the script are 777 (I know, it shouldn't be, but I was troubleshooting).
5.) Permissions for the directory containing the script is 755.
6.) Relevent entries in my httpd.conf file for this directory are:

<Files ~ (\.pl$)>
SetHandler perl-script
PerlHandler ModPerl::Registry
Options ExecCGI
allow from all
PerlSendHeader On
</Files>

Thanks again for your help!

Swaysteady
03-17-2006, 09:01 PM
:confused:
Go figure, the file *had* to have 755 (rwxr-xr-x) permissions. I switched them from 777 (rwxrwxrwx) to 755 and it worked. Switched it back to 777, got the same errors again. Well, now we know :)