I know there are some questions about this topic, but none seems to solve my issue. See this or this or this.
I'm on Linux, Fedora21, and I'm trying to enable per user directory CGI script. I followed these instructions, but without success.
I get the error:
[cgi:error] End of script output before headers: test.cgi
test.cgi
is an executable sh file, containing a very simple script:
#!/usr/bin/sh
echo "Content-type: text/plain"
echo ""
echo "Hello"
which has executable flag and runs without problems from shell. I also tried with Python: same result.
I also disabled selinux for good measure.
I also tried setting the debug
level to Apache's ErrorLog, but all I get is only "granted" permissions before the error above.
I also configured the /etc/httpd/conf.d/userdir.conf
file with
<Directory "/home/*/public_html">
AllowOverride All
Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec
Require all granted
</Directory>
<Directory /home/*/public_html/cgi-bin/>
Options ExecCGI FollowSymLinks
SetHandler cgi-script
AddHandler cgi-script .cgi .exe .pl .py .vbs
Require all granted
AllowOverride All
</Directory>
and restarted the server. No success. Everything looks fine to me, I can't understand... What's wrong??
EDIT:
I forgot to add that the issue is just for per-user directory: if I move the same script to /var/www/cgi-bin
directory, it works as expected.
EDIT 2:
The shell does exist:
$ ls /usr/bin/sh
/usr/bin/sh