Configuring and Testing a PERL Script with IIS 5.0

ID: Q245225


The information in this article applies to:
  • Microsoft Internet Information Services version 5.0


SUMMARY

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 ISAPI.

NOTE: The third-party products discussed in this article are manufactured by vendors independent of Microsoft; we make no warranty, implied or otherwise, regarding these products' performance or reliability.

For more information on ActiveState's PERL interpreters, see the following Web site:

http://www.activestate.com/


MORE INFORMATION

Microsoft provides programming examples for illustration only, without warranty either expressed or implied, including, but not limited to, the implied warranties of merchantability and/or fitness for a particular purpose. This article assumes that you are familiar with the programming language being demonstrated and the tools used to create and debug procedures. Microsoft support professionals can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific needs. If you have limited programming experience, you may want to contact a Microsoft Certified Solution Provider or the Microsoft fee-based consulting line at (800) 936-5200. For more information about Microsoft Certified Solution Providers, please see the following page on the World Wide Web:

http://www.microsoft.com/mcsp/
For more information about the support options available from Microsoft, please see the following page on the World Wide Web:

http://www.microsoft.com/support/supportnet/overview/overview.asp

Creating a Test PERL Script

Open a new file with Notepad, and copy the following lines of code. Save the file 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); 
Once you have created the file, you need to configure PERL to run securely with Internet Information Services. "Perl.exe" should not be located in any of the directories accessible by a user with a browser.

By using the Internet Service Manager MMC Snap-in, you can place the "Perl.exe" or "PerlIS.dll" outside of the normal Web directory structure a user has access to and use the "Script Mapping" feature of IIS to configure execution of PERL scripts.

Configuring PERL Script Mapping

  1. Select the Internet Services Manager (ISM) under the "Administrative Tools" menu.


  2. Right-click a Web site that you want to enable PERL for and select Properties.


  3. Select the Home Directory tab.


  4. Click Configuration button.


  5. Click Add.


  6. Enter the following for the "Executable":
    <full path to perlis.dll>\perlis.dll 
    Or the following:
    <full path to perl.exe>\perl.exe %s %s 
    NOTE: The "%s %s" is case sensitive (for example, "%S %S" will not work)


  7. Enter the following for the "Extension":
    .pl 
    NOTE: Make sure that the "All Verbs" radio button is selected for full functionality


  8. Click "OK" all the way back to the ISM


  9. Using the default scripts directory with IIS, the URL would be the following:
    
    http://<Server Name>/scripts/helloworld.pl 


Additional query words: iis

Keywords : kbIIS kbiis500
Version : winnt:5.0
Platform : winnt
Issue type : kbinfo


Last Reviewed: February 2, 2000
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.