Microsoft KB Archive/150629

= Configuring and Testing a PERL Script with Internet Information Server (IIS) =

Article ID: 150629

Article Last Modified on 6/23/2005

-

APPLIES TO


 * Microsoft Internet Information Server 1.0
 * Microsoft Internet Information Server 2.0
 * Microsoft Internet Information Server 3.0

-



This article was previously published under Q150629



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





SUMMARY
The following PERL script can be used to test for the proper installation and execution of CGI scripts with Internet Information server.



MORE INFORMATION
Create a file with Notepad, and type the following lines of code. Save the file in the scripts directory as Helloworld.pl.

print "HTTP/1.0 200 OK\n"; print "Content-Type: text/html\n\n";

print "\n"; print "\n"; print "Hello World\n"; print "\n"; print "\n"; print "Hello World\n"; print "\n"; print "Your IP Address is $ENV{REMOTE_ADDR}.\n"; print ""; print "Have a nice day</H5>\n"; print "</BODY>\n"; print "</HTML>\n";

Once you have created the file, you need to configure PERL to run securely with Internet Information. Perl.exe should not be located in any of the directories accessible by a user with a browser.

With a script mapping in the registry, you can place the Perl.exe outside of the normal directory structure a user has access to.

To configure PERL script mapping
WARNING: Using Registry Editor incorrectly can cause serious, system-wide problems that may require you to reinstall Windows NT to correct them. Microsoft cannot guarantee that any problems resulting from the use of Registry Editor can be solved. Use this tool at your own risk.


 * 1) Start Regedt32.exe and open the following registry key:

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W3SVC \Parameters\ScriptMap
 * 1) Click Add Value from the Edit menu.
 * 2) The Value Name is .pl
 * 3) The Data type is REG_SZ.
 * 4) The String value is <the full path to perl.exe>\perl.exe %s %s

NOTE: The "%s %s" is case sensitive. (e.g. "%S %S" will not work).
 * 1) Restart the WWW service.

Now that the registry has been configured, you can test the PERL script with your browser. Using the defaults directory structure with IIS, the URL would be the following:

http://<Server Name>/scripts/helloworld.pl?

Additional query words: CGI PERL

Keywords: kbinfo KB150629

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.