Forum Moderators: phranque
NameVirtualHost 127.0.0.1:80
<VirtualHost 127.0.0.1:80>
ServerName www.sitio1.com
SuexecUserGroup nobody #-1
DocumentRoot /usr/local/apache/htdocs/www/sitio1
</VirtualHost>
<Directory /usr/local/apache/htdocs/www/sitio1/cgi-bin>
Options ExecCGI
AddHandler cgi-script cgi pl
</Directory>
Of course module suexec is loaded and user and group are correct.
In the cgi-bin folder I have the following cgi file:
#!/bin/sh
echo "Content-type: text/html"
echo ""
echo "<html><head><title>Test</title></head>"
echo "<body bgcolor=yellow>"
echo "<H2>Hello world</H2>"
echo "</body>"
echo "</html>"
When I try to execute it I get an internal server error and error_log gives the following error: Premature end of script headers:
I think the script is properly written, anyway I have tried with more test scripts and it keeps on the same message, so I believe it's a problem from Apache. Any idea of what can be happening?
did you check the suexec-log (been a while since I've worked with suexec, but I recall there was a log-option)?
just tested it on my server and it works just fine (allthough, I did get the same error at first, because I just copy pasted into vim and I'm not really used to it and it commented out all the lines). Generally, apache is usually more helpful in it's errorlog. The blank error you get looks like no output was generated from the script.
Do other scripts work, like, a simple
#!/usr/bin/perl -w
print "Content-type: text/html\n\nhello world";
The problem, in fact is writeen on the httpd.conf file:
# . On HPUX you may not be able to use shared memory as nobody, and the
# suggested workaround is to create a user www and use that user.
The group was also wrong, and I had to create a new one.
Thanks a lot for your help.