Re: Premature Ending of script headers



Here is my problem. I posted it in the apache group and got no answers.
I tried the way you told me. It won't work.

Problem: unknown reason to "premature ending of script headers" error
message

I run a simple perl cgi problem on my machine.

---------------------------hello.cgi-------------------------------
#! /usr/bin/perl
use CGI::Carp qw(fatalsToBrowser);
{
local ($oldbar) = $|;
$cfh = select (STDOUT);
$| = 1;
print "Content-type: text/html\n\n";
$| = $oldbar;
select ($cfh);
}

print "hello\n";
--------------------------------------------------------------------

I run it in some other places and works fine.

Now I upload to another server and got the error message I mentioned.(
I checked it with pico first.)
I changed my configuration file for httpd as follows:

uncomment "UserDir public_html",
uncomment the following:
<Directory /home/*/public_html>
AllowOverride FileInfo AuthConfig Limit
Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec
<Limit GET POST OPTIONS>
Order allow,deny
Allow from all
</Limit>
<LimitExcept GET POST OPTIONS>
Order deny,allow
Deny from all
</LimitExcept>
</Directory>

add the following
<Directory /home/*/public_html/cgi-bin>
Options ExecCGI
SetHandler cgi-script
</Directory>

uncomment addHandler cgi-script .cgi

-------------------------------------
Then I changed the following file permissions:
chmod 711 /home/*
chmod 755 /home/*/public_html
chmod 755 /home/*/public_html/*.html
chmod 755 /home/*/public_html/cgi-bin
chmod 755 /home/*/public_html/cgi-bin/*.cgi

And the machine still still gives me the error

But if I use the ScriptAlias
ScriptAlias /cgi-bin2/ /home/span/public_html/cgi-bin/

I can run the hello.cgi well from http://localhost/cgi-bin2/

I want to know what could be the reason I can't run my cgi from
http://localhost/~span/cgi-bin /hello.cgi
(span is one of the users ).

.