Microsoft KB Archive/245225

= HOW TO: Configure and Test a PERL Script with IIS 4.0, 5.0, 5.1, and 6.0 =

Article ID: 245225

Article Last Modified on 12/3/2007

-

APPLIES TO


 * Microsoft Internet Information Server 4.0
 * Microsoft Internet Information Services 5.0
 * Microsoft Internet Information Services 5.1
 * Microsoft Internet Information Services 6.0

-



This article was previously published under Q245225



We strongly recommend that all users upgrade to Microsoft Internet Information Services (IIS) version 6.0 running on Microsoft Windows Server 2003. IIS 6.0 significantly increases Web infrastructure security. For more information about IIS security-related topics, visit the following Microsoft Web site:

http://www.microsoft.com/technet/security/prodtech/IIS.mspx



The third-party products that are discussed in this article are manufactured by companies that are independent of Microsoft. Microsoft makes no warranty, implied or otherwise, regarding the performance or reliability of these products.

IN THIS TASK
SUMMARY
 * Create a Test PERL Script
 * Configure PERL Script Mapping for IIS 4.0
 * Configure PERL Script Mapping for IIS 5.0 and 5.1
 * Configure PERL Script Mapping for IIS 6.0

REFERENCES



SUMMARY
This step-by-step article describes how to configure and test a PERL script with Internet Information Server (IIS) version 4.0 and Internet Information Services (IIS) versions 5.0, 5.1, and 6.0.

The following PERL script can be used with IIS to test for the correct installation and execution of both Common Gateway Interface (CGI) and Internet Server Application Programming Interface (ISAPI) PERL script language interpreters, such as ActiveState PERL and PERL for ISAPI.

For more information about ActiveState PERL interpreters, visit the following ActiveState Web site:

http://www.activestate.com/

back to the top

Create a Test PERL Script
In Notepad, save the following lines of code in the Scripts directory as Helloworld.pl: $url = "http://$ENV{SERVER_NAME}$ENV{URL}"; $ip = "$ENV{REMOTE_ADDR}"; print < Hello World!  Hello World! You have reached $url Your IP Address is $ip</P> <H5>Have a nice day!</H5> </BODY> </HTML> ENDOFTEXT exit(0); Note The PERL language permits no spaces at the beginning of a line.

Note After you create the file, you must configure PERL to run securely with IIS. Do not put Perl.exe in any of the directories that are accessible by a user with a browser.

By using the Internet Service Manager (ISM) Microsoft Management Console (MMC) snap-in, you can put the Perl.exe or PerlIS.dll files outside the typical Web directory structure that a user has access to, and you can use the Script Mapping feature of IIS to configure execution of PERL scripts.

back to the top

Configure PERL Script Mapping for IIS 4.0
<ol> <li>Click Start, click Programs, click Windows NT 4.0 Option Pack, click Microsoft Internet Information Server, and then click Internet Service Manager.</li> <li>Right-click a Web site that you want to enable PERL for, and then click Properties.</li> <li>Click the Home Directory tab.</li> <li>Click Configuration.</li> <li>Click Add.</li> <li>Type the following for Executable:

\perlis.dll

You can also type the following:

\perl.exe %s %s

Note: The "%s %s" is case sensitive (for example, "%S %S" does not work).</li> <li>For Extension, type .pl.

Note Make sure that the All Verbs option is selected for full functionality, and that the Script Engine check box is selected.</li> <li>Click OK to return to the ISM. With the default scripts directory with IIS, the URL is the following:

http:// /scripts/helloworld.pl

</li></ol>

back to the top

Configure PERL Script Mapping for IIS 5.0 and 5.1
<ol> <li>Click Start, click Programs, click Administrative Tools, and then click Internet Information Services.</li> <li>Right-click a Web site that you want to enable PERL for, and then click Properties.</li> <li>Click the Home Directory tab.</li> <li>Click Configuration.</li> <li>Click Add.</li> <li>Type the following for Executable:

\perlis.dll

You can also type the following:

\perl.exe %s %s

Note The "%s %s" is case sensitive (for example, "%S %S" does not work).</li> <li>For Extension, type .pl.

Note Make sure that the All Verbs option is selected for full functionality. Also, make sure that the Script Engine check box is selected.</li> <li>Click OK to return to the ISM. With the default scripts directory with IIS, the URL is the following:

http:// /scripts/helloworld.pl

</li></ol>

back to the top

Configure PERL Script Mapping for IIS 6.0
<ol> <li>Click Start, click Programs, click Administrative Tools, and then click Internet Information Services.</li> <li>Right-click a Web site that you want to enable PERL for, and then click Properties.</li> <li>Click the Home Directory tab.</li> <li>Click Configuration.</li> <li>Click Add.</li> <li>In the Executable box, type the following:

\perlis.dll

You can also type the following:

\perl.exe %s %s

Note The "%s %s" is case sensitive (for example, "%S %S" does not work).</li> <li>In the Extension box, type .pl .'''

Note Make sure that the All Verbs''' option is selected for full functionality. Also, make sure that the Script Engine check box is selected.</li> <li>Click OK to return to the ISM.</li> <li>Click the Web Service Extensions folder.</li> <li>Click Add a new Web service extension.</li> <li>Type a name for the extension, such as "PERL Scripts."</li> <li>Click Add, type the full path to the Perl.exe file, and then click OK.</li> <li>Make sure that the Set extension status to Allowed check box is selected.</li> <li>Click OK to return to the ISM. With the IIS default scripts directory, the URL is the following:

http:// /scripts/helloworld.pl

</li></ol>

back to the top

<div class="references_section">