I have recently installed ubuntu linux and also setup apache2 web server with cgi and perl. went into my config file in apache2 and set the scriptalias folder to /home/www/cgi-bin instead of keeping the default which was /var/www/.
created the simplest perl file, made sure the script was going back to /usr/bin/perl path, set proper permissions for perl script (755) and also set directories as well. set my ip as static and made sure it was my localhost. when i try to run the perl file in my browser it gives me an "exec format error". please help...
print "Content-type: text/html\r\n\r\n";
print "Hello, World.";
name of perl script is: perltest.pl
this is my whole config file word for word:
Options Indexes FollowSymLinks MultiViews
allow from all
ScriptAlias /cgi-bin/ /home/www/cgi-bin/
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Allow from all
AddHandler cgi-script cgi pl
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
CustomLog /var/log/apache2/access.log combined
Alias /doc/ "/usr/share/doc/"
Options Indexes MultiViews FollowSymLinks
Deny from all
Allow from 127.0.0.0/255.0.0.0 ::1/128
the path to my config file is /etc/apache2/sites-available/default.
*sorry if I'm getting a little too semantic, i'm just frusturated...
this is what my (firefox) browser returns:
Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator, webmaster@localhost and inform them of the time the error occurred, and anything you might have done that may have caused the error.
More information about this error may be available in the server error log.
Apache/2.2.8 (Ubuntu) mod_perl/2.0.3 Perl/v5.8.8 Server at 192.168.*.* Port 80
[Wed Jun 10 20:37:29 2009] [error] (8)Exec format error: exec of '/home/www/cgi-bin/perltest.pl' failed
[Wed Jun 10 20:37:29 2009] [error] [client 192.168.*.*] Premature end of script headers: perltest.pl
OS: UBUNTU 8.04
Web Server: Apache2
site where I followed instructions from: