Microsoft Knowledge Base Email Alertz

The following PERL script can be used with Microsoft's Internet Information Services (IIS) to test for the proper installation and execution of both CGI and ISAPI PERL script language interpreters, such as ActiveState's PERL and PERL for IS

Search KbAlertz

Advanced Search

Receive Microsoft Knowledge Base articles by E-Mail?

Every night we scan the Microsoft Knowledge Base. If technologies you're interested in are updated, we'll send you an e-mail. You only get one e-mail a day, and only when new articles are added.

Click here to create a
FREE account
Already have an account?
[Click here to Login]











Microsoft Knowledge Base Article

This article contents is Microsoft Copyrighted material.
©2005-©2007 Microsoft Corporation. All rights reserved. Terms of Use | Trademarks

Article ID: 245225 - Last Review: July 7, 2008 - Revision: 6.1

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

This article was previously published under Q245225
We strongly recommend that all users upgrade to Microsoft Internet Information Services (IIS) version 7.0 running on Microsoft Windows Server 2008. IIS 7.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 (http://www.microsoft.com/technet/security/prodtech/IIS.mspx)
For more information about IIS 7.0, visit the following Microsoft Web site:
http://www.iis.net/default.aspx?tabid=1 (http://www.iis.net/default.aspx?tabid=1)

On This Page

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/ (http://www.activestate.com/)

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 <<ENDOFTEXT;
HTTP/1.0 200 OK
Content-Type: text/html

<HTML>
<HEAD><TITLE>Hello World!</TITLE></HEAD>
<BODY>
<H4>Hello World!</H4>
<P>You have reached <a href="$url">$url</a></P>
<P>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.

Configure PERL Script Mapping for IIS 4.0

  1. Click Start, click Programs, click Windows NT 4.0 Option Pack, click Microsoft Internet Information Server, and then click Internet Service Manager.
  2. Right-click a Web site that you want to enable PERL for, and then click Properties.
  3. Click the Home Directory tab.
  4. Click Configuration.
  5. Click Add.
  6. Type the following for Executable:
    full path to perlis.dll\perlis.dll
    You can also type the following:
    full path to perl.exe\perl.exe %s %s
    Note: The "%s %s" is case sensitive (for example, "%S %S" does not work).
  7. 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.
  8. Click OK to return to the ISM. With the default scripts directory with IIS, the URL is the following:
    http://Server Name/scripts/helloworld.pl

Configure PERL Script Mapping for IIS 5.0 and 5.1

  1. Click Start, click Programs, click Administrative Tools, and then click Internet Information Services.
  2. Right-click a Web site that you want to enable PERL for, and then click Properties.
  3. Click the Home Directory tab.
  4. Click Configuration.
  5. Click Add.
  6. Type the following for Executable:
    full path to perlis.dll\perlis.dll
    You can also type the following:
    full path to perl.exe\perl.exe %s %s
    Note The "%s %s" is case sensitive (for example, "%S %S" does not work).
  7. 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.
  8. Click OK to return to the ISM. With the default scripts directory with IIS, the URL is the following:
    http://Server Name/scripts/helloworld.pl

Configure PERL Script Mapping for IIS 6.0

  1. Click Start, click Programs, click Administrative Tools, and then click Internet Information Services.
  2. Right-click a Web site that you want to enable PERL for, and then click Properties.
  3. Click the Home Directory tab.
  4. Click Configuration.
  5. Click Add.
  6. In the Executable box, type the following:
    full path to perlis.dll\perlis.dll
    You can also type the following:
    full path to perl.exe\perl.exe %s %s
    Note The "%s %s" is case sensitive (for example, "%S %S" does not work).
  7. 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.
  8. Click OK to return to the ISM.
  9. Click the Web Service Extensions folder.
  10. Click Add a new Web service extension.
  11. Type a name for the extension, such as "PERL Scripts."
  12. Click Add, type the full path to the Perl.exe file, and then click OK.
  13. Make sure that the Set extension status to Allowed check box is selected.
  14. Click OK to return to the ISM. With the IIS default scripts directory, the URL is the following:
    http://Server Name/scripts/helloworld.pl

REFERENCES

For additional information about PERL Script in IIS 1.0, 2.0, and 3.0, click the article number below to view the article in the Microsoft Knowledge Base:
150629  (http://kbalertz.com/Feedback.aspx?kbNumber=150629/EN-US/ ) Configuring and Testing a PERL Script with Internet Information Server (IIS)

APPLIES TO
  • Microsoft Internet Information Server 4.0
  • Microsoft Internet Information Services 5.0
  • Microsoft Internet Information Services version 5.1
  • Microsoft Internet Information Services 6.0
Keywords: 
kbhowtomaster KB245225
       

Community Feedback System

Very often, it takes hours to solve a problem. Very often, you've looked high and low, and have tried a lot of solutions. When you finally found it, chances are, it was because someone else helped you. Here's your chance to give back. Use our community feedback tool to let others know what worked for you and what didn't.

Please also understand that the community feedback system is not warranted to be correct, it's simply a system that we've built to let people try and help each other. If something in a feedback response doesn't make sense to you, or you're not comfortable making changes that the feedback talks about (like registry edits), please consult a professional.

Thank you for using kbAlertz.com Feedback System.

-- Scott Cate