You are on page 1of 2

Installing IIS server with Perl for CGI Programming

Applies to IIS 7.5 running on Windows 7 and using Activestate Perl


1. Login to your machine as administrator (not just as a user with administrator
rights use of the ap-iis-config utility below will require this).
2. Uninstall all old perl installations (go to control panel/programs and features,
click on the perl and click uninstall).
3. Download and Install activestate perl
Got to http://www.activestate.com/activeperl/downloads and download the
Windows (x86) version (unless you have a 64 bit machine unlikely).
Just say yes to everything here.
4. Create a folder to hold your perl CGI scripts c:\perlscripts (or wherever you
like called whatever you like just make sure you refer to the same folder
when doing the mapping using the ap-iis-config command below.)
5. Call up a command window using cmd
6. Use the ap-iis-config command as shown below to add mappings and a virtual
directory for perl scripts.
First use:
ap-iis-config add
all
--cgi --isapi --perlex
Then use:
ap-iis-config add
vdir --name cgi-bin
--path c:\perlscripts
7. Now you can call scripts from a browser. For example:
http://localhost/cgi-bin/eg1.pl

Notes
General server stuff on activestate Perl in windows:
http://docs.activestate.com/activeperl/5.10/faq/Windows/ActivePerlWinfaq6.html
Specific manual for iis-config command:
http://docs.activestate.com/activeperl/5.10/bin/ap-iis-config.html
To test your installation, store this program in a file called eg1.pl in the c:\perlscripts
folder and run it from a browser using the URL http://localhost/cgi-bin/eg1.pl:
#!/usr/local/bin/perl
use CGI qw(:standard);
print header;
print start_html('A Simple Example'),
h1('A Simple Example'),
start_form,
"What's your name? ",textfield('name'),
p,
"What's the combination?",
p,
checkbox_group(-name=>'words',
-values=>['eenie','meenie','minie','moe'],
-defaults=>['eenie','minie']),
p,
"What's your favorite color? ",
popup_menu(-name=>'color',
-values=>['red','green','blue','chartreuse']),
p,
submit,
end_form,
hr;
if (param()) {
print
"Your name is",em(param('name')),
p,
"The keywords are: ",em(join(", ",param('words'))),
p,
"Your favorite color is ",em(param('color')),
hr;
}

You might also like