Using PERL on IIS 3.0


How to run PERL scripts on NT 4 via IIS 3.0

The problem is when the HTML page requests a PERL script instead of executing the script. The user is prompted to Save the perl script into a directory on the client machine. Not what you want...


Here's our solution:

We assume that you have IIS 3.0 and NT Server configured correctly, its default settings are fine.

The HTML file should have a request for the PERL script something along the lines of...

<html >
<head>
<title>PERL SCRIPT TEST</title>
</head>
<body>
<form> METHOD="GET" ACTION="http://www.domain.com/Scripts/test.pl?">
<input type=submit value="Run PERL Script">
</form>
</body>
</html>


Note: The question mark after the PERL extension. This is needed. Without it, it'll prompt you for the Save to disk.

Now for the sample PERL script.....

print <<"END";
HTTP/1.0 200 OK
Content-Type: text/html
END

print "<html>";
print "<head>";
print "<title>Test PERL Script</title>";
print "</head>";
print "<body>";
print "<h1>Hello World</h1>";
print "</body>";
print "</html>";
exit;


The important points about this PERL script are the first two lines, these are the MIME headers that basically tell your browser what to do with this file. In this case display it within the browser.

As an experiment try the following

1. Don't put the question mark after the .pl in your HTML file.
2. Leave out the PERL headers, one at a time then both of them.

See what results you get within your browser.