I am trying to work through an example from CGI101 (Jaqueline Hamilton's book) and my head is getting turned around. I have two files: env.cgi which looks like
#!C:/Perl/bin/perl -wT
use strict;
use CGI qw(:standard);
use CGI::Carp qw(warningsToBrowser fatalsToBrowser);
use CGI::Pretty;
print header;
print start_html("Environment");
foreach my $key (sort(keys(%ENV))) {
print "$key = $ENV{$key}<br>\n";
}
print end_html;
and envform.html which looks like this:
<html><head><title>Test Form</title></head>
<body>
<form action="env.cgi" method="GET">
Enter your text here:
<input type="text" name="sample_text" size=30>
<input type="submit"><p>
</form>
</body></html>
When I type http://localhost/cgi-bin/cgi101/ch03/envform.html into my web browser and hit 'go', I get a 500 Internal Service Error. Both have permissions 755.
I get two lines in C:\Apache2\log\error.log:
[Wed Jul 12 10:13:04 2006] [error] [client 127.0.0.1] C:/Apache2/cgi-bin/cgi101/ch03/envform.html is not executable; ensure interpreted scripts have "#!" first line
[Wed Jul 12 10:13:04 2006] [error] [client 127.0.0.1] (9)Bad file descriptor: don't know how to spawn child process: C:/Apache2/cgi-bin/cgi101/ch03/envform.html
If I go to C:\Apache2\cgi-bin\cgi101\ch03\envform.html and hit 'go', it properly displays the html page, but when I enter text and press the submit button, it displays the contents of the file env.cgi rather than running the script as file:///C:/Apache2/cgi-bin/cgi101/ch03/env.cgi?sample_text=my+text+here.
I'm not sure what I'm doing wrong here, but I think I've got a poor understanding of how env.cgi and envform.html are supposed to work together (which is no fault of the tutorial, but of my head full of bad wiring).
Any explanation would be appreciated.
Thanks.