Configuring httpd.conf for CGI in Apache 2.x
I am having a lot of difficulty configuring httpd.conf to handle CGI, specifically having it work with /home/*/public_html/cgi-bin/. I am using RedHat 9.0.
I keep getting the error: "Premature end of script headers:"
I have checked the Apache FAQ and documentation and several forums, but none of the listed solutions have worked.
My httpd.conf (relevant part) file looks like this:
---code
ScriptAlias /cgi-bin/ "/var/www/cgi-bin/"
<IfModule mod_cgid.c>
Scriptsock run/httpd.cgid
</IfModule>
<Directory "/var/www/cgi-bin">
AllowOverride None
Options None
Order allow,deny
Allow from all
</Directory>
<Directory "/home/*/public_html">
AllowOverride None
Options None
Order allow,deny
Allow from all
</Directory>
AddHandler cgi-script cgi pl
<Directory "/home/*/public_html/cgi-bin">
AllowOverride None
Options +ExecCGI
Order allow,deny
Allow from all
</Directory>
---end code
I am not using "SetHandler cgi-script" because I want to be able to put .html files in that directory, when I did have it in I still got the same error.
I am testing with the following perl script:
--- code
#!/usr/bin/perl
print "Content-type: text/html\n\n";
print "Hello, World.";
--- end code
The oddest thing is that in the /var/www/cgi-bin directory, this script actually works. But in my cgi-bin directory (~/public_html/cgi-bin) I get the header error. In addition, a script that I wrote a year ago (on different server - I changed the shebang line when I moved to this server) won't work in either directory.
Permissions to directories and files are all set to 655.
I am at a loss as to what the problem may be and hope I can get some suggestions.
Thanks.
|