I'm tring to get cgi working on my server at home, just so I can learn how to do it.
The setup is that the ScriptAlias is to my cgi-bin folder /usr/www/cgi-bin and that folder has <Directory> options:
AddHandler cgi-script .cgi .pl
When I try and run my script, first.pl, i get an internal server error. Apache2's error is:
[Thu Dec 09 10:17:12 2004] [error] [client 10.0.0.1] (8)Exec format error: exec of '/usr/www/cgi-bin/first.pl' failed
[Thu Dec 09 10:17:12 2004] [error] [client 10.0.0.1] Premature end of script headers: first.pl
This is apparently quite a normal error.
I think I know how to get everything working, however, my qustion is to clarify how cgi is working.
When I set the Handler, should I have installed a seperate module, or is it installed by default, but turned off (I think my apache config turns it on)? Is it the cgi module which executes these files?
Secondly, do I need to install perl on my server, or is that also installed by default? If so, how does one turn it on?
The apache documentation suggested executing the first.pl file from the command line, which i did:
root@pi cgi-bin # ./first.pl
./first.pl: line 2: print: command not found
./first.pl: line 3: print: command not found
DOes this mean that perl is not installed on my server? I have seen a couple of references to Perl in the apache config file, but didn't touch them.
Any pointign in the right direction would be very much appreciated.