How do I get IIS to use ActivePerl for my CGI scripts?
During installation, ActivePerl creates script mappings in IIS for the .pl and .plx extensions but not the .cgi extension. To support the .cgi file extension, you will need to replicate the .pl extension settings.
In the Add/Edit dialog-box, ensure the following settings are correct:
Click OK to close all of the open dialog-boxes. You should now be able to place the cgi files you want to run into the wwwroot folder (usually c:\inetpub\wwwroot\), or create a virtual web directory in IIS to the location of your cgi files.
How do I configure Apache to use ActivePerl for CGI?
To configure appache to use ActivePerl for CGI:
# DocumentRoot: The directory out of which you will serve your # documents. By default, all requests are taken from this directory, but # symbolic links and aliases may be used to point to other locations. # DocumentRoot "C:/apacheroot"
Options FollowSymLinks AllowOverride None
on the Option line, add "ExecCGI":
Options FollowSymLinks ExecCGI
#AddHandler cgi-script .cgi
Remove the '#' at the beginning to uncomment this line.
AddHandler cgi-script .cgi
If you want to use the .pl extension for your CGI scripts, change the extension
so that the line looks like this:
AddHandler cgi-script .pl
Save and close httpd.conf.
http://localhost/test.pl in your browser.
The test script:
#!c:\perl\bin\perl.exe
# ^^^ this must be the first line of the script! ^^^
# start code
use strict;
use CGI;
my $q = new CGI;
# print header and start the markup output
print $q->header( "text/html" ),$q->start_html( "hello from perl cgi!" );
print $q->h2("Hello World!");
print $q->end_html;
# end code