Although it does not ship with built-in support for executing
Perl scripts, it's easy enough to add Perl support to Internet
Information Server.
Once the Perl interpreter is installed, you should be able
to place Perl CGI scripts in any scripts directory, such
as the default /scripts scripts directory. You can
also create a new scripts directory, named cgi-bin for
example, by physically creating an empty directory on the
hard drive, adding it to the Internet Information Server
manager and enabling the Execute attribute (Script attribute
in Microsoft IIS 4.x).
Note: For security reasons, you do not want Perl.exe to
exist in any directory that can be browsed from other computers.
With a script mapping in the registry, you can place the
Perl.exe outside of the normal directory structure and avoid
such security risks
- Make sure your Web
Server is properly installed and functioning.
Download and
install Perl 5 for Windows. The files will be extracted
to your temporary folder ("C:\Windows\temp" on
Windows 95/98 machines and "C:\temp" on Windows
NT/2000 machines). Open this folder through Windows Explorer,
then double click on the Install.exe file.
- Configure Perl script maps.
WARNING: Using Registry Editor incorrectly can cause
serious problems that may require you to reinstall your operating
system. Use the Registry Editor at your own risk.
For information about how to edit the registry, view the "Changing Keys and
Values" Help topic in Registry Editor (Regedit.exe) or the "Add and Delete
Information in the Registry" and "Edit Registry Data" Help topics in Regedt32.exe.
Note that you should back up the registry before you edit it. If you are running
Windows NT or Windows 2000, you should also update your Emergency Repair Disk
(ERD). Update the registry as follows:
- Start regedt32.exe and Open HKEY_LOCAL_MACHINE\ SYSTEM\CurrentControlSet\
Services\W3SVC\Parameters\ ScriptMap
- Select "Add Value" from the "Edit" menu.
- Set "Value Name" to .pl (or .cgi if
you plan to name your scipts with a .cgi extention)
- Set "Data type" to REG_SZ
- Set "String value" to: \perl.exe
%s %s: for example, if you installed
Perl in C:\PERL, type c:\perl\bin\perl.exe
%s %s
- Open "Internet Service Manager" for Microsoft
IIS 4.x
- Right click on the web server entry under
the "Internet Information Server" folder
and select "Properties"
- Restart all Internet Information Server services and/or
restart the server machine.
NOTE: This will map the .pl file extension to the Perl
interpreter on all directories under the selected web server.
To enable Perl scripts on just
a single virtual
directory, select that directory instead and go to its "Properties".
Select "WWW Service" under "Master Properties" and click
on "Edit..."
Change to the "Home Directory" tab Click on "Configuration..." Select ".pl" entry
(or add one) and click on "Edit" Set "Executable" parameter
to: \perl.exe
%s %s
For example, if you installed Perl in C:\PERL, type c:\perl\bin\perl.exe
%s %s Apply changes and close "Internet Service Manager"
WARNING: Using Registry Editor incorrectly can cause
serious problems that may require you to reinstall your operating
system. Use the Registry Editor at your own risk.
For information about how to edit the registry, view the "Changing Keys and
Values" Help topic in Registry Editor (Regedit.exe) or the "Add and Delete
Information in the Registry" and "Edit Registry Data" Help topics in Regedt32.exe.
Note that you should back up the registry before you edit it. If you are running
Windows NT or Windows 2000, you should also update your Emergency Repair Disk
(ERD).
- On the Start menu, click Run.
- In the Open box, type Regedit and click OK.
- Open HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W3SVC
\Parameters\ScriptMap
- On the Edit menu, point to New, and click String
Value.
- Name the value .pl and press ENTER.
- Select .pl, and click Modify on the Edit menu.
- In the Value Data box, type <the full path
to perl.exe>\perl.exe %s %s
NOTE: The "%s %s" is case sensitive (for example, "%S %S" will
not work).
- Close the Registry Editor, and restart your computer.
NOTE: Some versions of PERL automatically add this registry
key when you install.
Create a file with Notepad, and type the following lines of
code. Save the file as testing.pl in a folder in your
web. Make sure this folder is marked executable.
In Notepad, type the following:
| |
print "HTTP/1.0 200 OK\n";
print "Content-Type: text/html\n\n";
print "<HTML>\n";
print "<HEAD>\n";
print "<TITLE>Perl Test Page</TITLE>\n";
print "</HEAD>\n";
print "<BODY>\n";
print "<H3>This is a test to see if Perl is Working</H3>\n";
print "<P>\n";
print "<H5>If you can see this, Perl is properly configured</H5>\n";
print "</BODY>\n";
print "</HTML>\n";
|
To test the script, browse to the Perl script in Internet Explorer. For example,
if you placed the testing.pl file in a folder named cgi-bin in your root web,
you would type the following in the Internet Explorer address bar:
http://localhost/cgi-bin/testing.pl
The third-party products discussed in this article are manufactured by vendors
independent of Taltech; we make no warranty, implied or otherwise, regarding
these products' performance or reliability.
Related Links
Introduction to Active Server Pages
Using TAL Barcode ActiveX Plus with Active
Server Pages
|