Making Perl work with IIS 6

As anyone who reads this blog knows, I recently, changed positions in my company (from Solutions Engineer to Senior Web Developer). One of the first tasks my new manager gave me was to install an IIS web log analysis tool so we can track what people are looking at on one of our internal web sites.

I chose AWStats because it’s easy to install, easy to configure, and gives us all the information we need (oh… and it’s free too).

I’ve used this handy app in the past on my web server (Linux) and have installed it on a couple of Windows 2000 servers in the past. It was always quick and easy…. until I tried to do it on Windows 2003 using IIS 6.

IIS 6 is a total steaming pile, and they’ve made integrating Perl into it extremely non-intuitive. If you follow the same steps that you would to install everything on IIS 5x, you’ll get nothing but 404 errors. To make your life easy… I’m presenting you with everything you need to know after you install Perl and AWStats.

The problem: You install ActivePerl and AWStats on Windows 2003 with IIS 6, but you keep getting a 404 error when you try to view the page .

The solution: Install Apache! Oh… you want to use IIS? Ok… follow these directions then:

I’m going on the assumption that you’ve already installed ActivePerl and AWStats on your server (and set the IIS logs and built the conf file). These instructions also assume that you’re going to add the .pl extension. If you want to add .cgi, just replace “cgi” everyplace you see “pl”.
Launch IIS (it’s in the administrative tools), and navigate to your website

Right Click on “Default Web Site” and select “Properties” from the pop-up menu

iis1.png

Select the “Home Directory” tab at the top, then click the “Configuration” button

iis2.png

Now, we add the Perl .pl extension to IIS’s application extensions. Click the “Add” button

3

Now, add the full path to where you installed ActivePerl in the “Executable” box exactly as shown (replacing the path of “C:\perl\ with the path you installed to if needed), and add ‘pl’ (not ‘.pl’) into the extension box. Make sure it’s set to “All verbs” and “Script engine”. Click “Ok” when you’re done.

4

Click “OK” to everything until you’re back to the main IIS screen.

Now… we need to add the Web Service Extension. On the left hand side of the main IIS window, click “Web Service Extensions”, then click “Add a new Web service extension” on the right.

iis5.png

In the “Extension Name” field, type in ActivePerl (or perl, or “I like peanut butter”… it really doesn’t matter, but putting in the application name and perhaps the version number will make your life easier in the future). Put a check in the “Set extension status to Allowed”, and then click the “Add” button.
iis6.png

Under “Path to file”, put in the path to the perl.exe file (make sure to put in the “%s” %s arguments just like you did when you created the application extension).
iis7.png

Click on “OK” to everything until you’re back to the basic IIS screen. You’re done! IIS will now read Perl pages with the .pl extension (or .cgi if you went that route).

And additional note: I had to (via Windows NTFS permissions) give the IUSR_MACHINE-NAME (where “MACHINE-NAME” is your computer’s name) READ/WRITE/EXECUTE rights to the folder that AWStats was installed to and READ permissions on the log folder (to let me to a web based update in AWStats).

Oh… and here are some keywords for google to pick up on:
Perl IIS 6 404 Error AWStats Install

Edit: I also found this dandy little page (after the fact) that walks you through the process as well: http://www.visualwin.com/Perl/