Hi since other posts about this topic didn't do me much justice ( none of them seem to apply for Ubuntu 13.10, the version of Ubuntu I run), I decided to make another one. After running these lines ( a fellow stackoverflow member suggested running these)..
cd /etc/apache2/mods-enabled
sudo ln -s ../mods-available/cgi.load .
sudo ln -s ../mods-available/cgid.load .
sudo service apache2 restart
I placed the cgi files ( they are perl ones ) into my Apache2's cgi-bin @ /usr/lib/cgi-bin. When typing localhost/cgi-bin/test.cgi, I got a 500 Internal server error. This is what the Server error log says..
[Fri Nov 22 21:23:29.045785 2013] [cgi:error] [pid 9559] [client 127.0.0.1:47663] AH01215: (8)Exec format error: exec of '/usr/lib/cgi-bin/test.cgi' failed [Fri Nov 22 21:23:29.046720 2013] [cgi:error] [pid 9559] [client 127.0.0.1:47663] End of script output before headers: test.cgi
test.cgi looks like this...
#!/usr/bin/perl
print "Content-type: text/html\n\n";
print <<HTML;
<html>
<head>
<title>A Simple Perl CGI</title>
</head>
<body>
<h1>A Simple Perl CGI</h1>
<p>Hello World</p>
</body>
HTML
exit;
Does anyone know what to do when then happens or have any suggestions? Thanks
EDIT:: Oddly enough, I got this cgi file i call test2.cgi to run.
#!/usr/bin/perl
use strict;
use warnings;
sub main {
print "Content-type: text/html\n\n";
print "Hello world\n\n";
print "What's your favorite food brah?\n";
}
main();
But the larger, more advanced cgi files that I need to work on wont run. These ones include stuff being printed out in html tags.
EDIT: Ignore any weird spacing in code. Its just how i copied it into the post.