Perl Tutorials - Herong's Tutorial Examples - Version 5.32, by Dr. Herong Yang
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
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