I have the following entry under
apache2.conf in my Debian box.
AddHandler cgi-script .cgi .pl Options +ExecCGI ScriptAlias /cgi-bin/ /var/www/mychosendir/cgi-bin/ <Directory /var/www/mychosendir/cgi-bin> Options +ExecCGI -Indexes allow from all </Directory>
Then I have a perl cgi script stored under these directories and permissions:
nvs@somename:/var/www/mychosendir$ ls -lhR .: total 12K drwxr-xr-x 2 nvs nvs 4.0K 2010-04-21 13:42 cgi-bin ./cgi-bin: total 4.0K -rwxr-xr-x 1 nvs nvs 90 2010-04-21 13:40 test.cgi
However when I tried to access it in the web browser:
They gave me this error:
[Wed Apr 21 15:26:09 2010] [error] [client 126.96.36.199] (8)Exec format error: exec of '/var/www/mychosendir/cgi-bin/test.cgi' failed [Wed Apr 21 15:26:09 2010] [error] [client 188.8.131.52] Premature end of script headers: test.cgi
What's wrong with it?
I also have the following entry in my
<Files ~ "^\.ht"> Order allow,deny Deny from all </Files>
And the content of
test.cgi is this:
#!/usr/bin/perl -wT print "Content-type: text/html\n\n"; print "Hello, world!\n";