Configuring IIS 5.0 for Perl Programs

This section describes how to configure IIS (Internet Information Services) Web server to run Perl programs through CGI (Common Gateway Interface).

One of most commonly used areas of Perl language is Web server side application. If your application is written in Perl, and want to run it through a Web browser request, you must configure your Web server to be able to run the application. On a Unix system, this is very easy. But on a Windows system, you need to do some experiments.

I had Internet Information Services (IIS) 5.0 Web server running on my Windows 2000 system, and ActivePerl v5.6.1 installed on c:\perl. Here is what I did to run Perl programs with IIS.

1. Made a new sub directory in the default Web server home directory, c:\Inetpub\wwwroot\cgi-bin.

2. Copied my hello.pl to that new directory, c:\Inetpub\wwwroot\cgi-bin\hello.pl.

   print "Hello world!\n";

3. Ran "Internet Information Services (IIS)", selected "Default Web Site" under localhost, clicked the stop icon, then clicked the start icon. This was to restart the IIS server, so the new sub directory and the new Perl program can be picked up by the server.

4. On IIS, selected the cgi-bin directory, and right mouse clicked to view the properties window. On the Directory tab, saw Read and Write were checked, and Execution Permissions had "Script only".

5. Ran Internet Explorer (IE) with http:\\localhost\cgi-bin\hello.pl, a download windows came up asking me to save hellp.pl. Not too bad, my cgi-bin sub directory and hello.pl was reachable!

6. On IIS, selected "Default Web Sites", then right mouse clicked to view the properties window. On the "Home Directory" tab, clicked the "Configuration" button. Here I had to add a new entry into the Application Mappings:

Executable: c:\perl\bin\perl.exe %s
Extension: .pl
Verbs: All verbs
Script Engine: Checked

7. Tried again with IE on http:\\localhost\cgi-bin\hello.pl, and got the following output. Much better now, hello.pl got executed.

CGI Error
The specified CGI application misbehaved by not returning 
a complete set of HTTP headers. The headers it did return are:

Hello world!

8. Changed hello.pl to helloHttp.pl:

   print "Content-Type: text/html\n\n";
   print "<html><body>\n";
   print "Hello world!\n";
   print "</html></body>\n";
<html><body> <% out.println("Hello world!"); %> </body></html>

9. Finally, I got the perfect output with IE on http:\\localhost\cgi-bin\helloHttp.pl

Hello world!

Excellent! From now on, any files with .pl in the cgi-bin directory will be executed by perl.exe.

By the way, you could also follow the instructions provided by ActivePerl at: c:\Perl\html\faq\Windows\ActivePerl-Winfaq6.html

Table of Contents

 About This Book

 Perl on Linux Systems

 ActivePerl on Windows Systems

 Data Types: Values and Variables

 Expressions, Operations and Simple Statements

 User Defined Subroutines

 Perl Built-in Debugger

 Name Spaces and Perl Module Files

 Symbolic (or Soft) References

 Hard References - Addresses of Memory Objects

 Objects (or References) and Classes (or Packages)

 Typeglob and Importing Identifiers from Other Packages

 String Built-in Functions and Performance

 File Handles and Data Input/Output

 Open Files in Binary Mode

 Open Directories and Read File Names

 File System Functions and Operations

 Converting Perl Script to Executable Binary

 Using DBM Database Files

 Using MySQL Database Server

 Socket Communication Over the Internet

 XML::Simple Module - XML Parser and Generator

 XML Communication Model

 SOAP::Lite - SOAP Server-Client Communication Module

Perl Programs as IIS Server CGI Scripts

Configuring IIS 5.0 for Perl Programs

 perl.exe vs. perlis.dll

 CGI (Common Gateway Interface)

 XML-RPC - Remote Procedure Call with XML and HTTP

 RPC::XML - Perl Implementation of XML-RPC

 Integrating Perl with Apache Web Server

 CGI.pm Module for Building Web Pages

 LWP::UserAgent and Web Site Testing

 References

 PDF Printing Version