LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (http://www.linuxquestions.org/questions/linux-software-2/)
-   -   500 Internal Server Error/Premature end of script headers (http://www.linuxquestions.org/questions/linux-software-2/500-internal-server-error-premature-end-of-script-headers-430502/)

baruah 03-31-2006 08:49 PM

500 Internal Server Error/Premature end of script headers
 
Hi,
sorry for the repeating the same question. I believe many have encountered this and find a solution.

Problem is when I try to execute a CGI script from anyone of the user's directory I'm get the error
"Premature end of script headers:". The script works just fine from the "/var/www/cgi-bin" which is set as ScriptAliase.

In order run the script from the user's directory I have added the following in the httpd.conf file

AddHandler cgi-script .cgi
<Directory /home/*/public_html/cgi-bin>
Options ExecCGI
SetHandler cgi-script
</Directory>

Changed the ownership of the script to apache:apache and permission to 755

The script is

#!/bin/bash
echo Content-type: text/plain
echo ""
echo ""
/usr/bin/cal
echo ""

Can anyone help me please to run this ? I'm using "httpd-2.0.52-19.ent" on "2.6.9-22.EL" Kernel.

Thanks
Baruah

bathory 04-01-2006 05:10 PM

The only thing that comes in mind since you can execute your script from /var/www/cgi-bin is that you use suexec. Check with
Code:

/path/to/apache/bin/apachectl -V
or take a look at the logs when you restart apache to see if that's the case. Then you can either disable it, or read the whole document of the previous link in order to configure it correctly


All times are GMT -5. The time now is 10:31 PM.