Forum Moderators: phranque
I have been consulting guides to get CGI to work on a VPS but have hit a wall. I’ve activated the cgi mod, I’ve put "AddHandler cgi-script .cgi" at the end of my Apache2.conf file, and I’ve put the following into my the sites-available file for the domain:
ScriptAlias /cgi-bin/ /path_to_domain_location/public/cgi-bin
<Directory “/path_to_domain_location/public/cgi-bin”> AllowOverride None
Options +ExecCGI -multiviews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory> I’ve also chmod’d the cgi scripts to 755, and verified that they are uploaded in ASCII format. I’m getting this error:
...No such file or directory: exec of ‘/path_to_domain_location/public/cgi-bin/test.cgi’ failed
...Premature end of script headers: test.cgi Test.cgi is the following simple code for testing:
#!/usr/local/bin/perl
#
# hello_s.pl-- simple "hello, world" program to demonstrate basic
# CGI output.
#
# Print the CGI response header, required for all HTML output
# Note the extra \n, to send the blank line
print "Content-type: text/html\n\n" ;
# Print the HTML response page to STDOUT
print <<EOF ;
<html>
<head><title>CGI Results</title></head>
<body>
<h1>Hello, world.</h1>
</body>
</html>
EOF
exit ;
Any ideas what i’m missing?
Cheers,
Don