Configuring Perl on IIS 7.0

Posted by lschult2 on 2007-02-21 23:59

I am trying to configure Perl on IIS 7.0, and all the documentation I can find on configuring IIS is for 6.0 and lower. And 7.0 is different, so I can't figure out how to configure this correctly.

Can anyone tell me how to do this?

EarlW | Fri, 2007-03-16 11:57

I, too was stumped by this and could find nothing useful on the net - so figured it out by trial and error and by poring through pages of info on the internet.

  1. Make sure that you have installed Perl and that it is in your path command as per instructions elsewhere on ActiveState (c:\Perl is where I have it.)
  2. Make sure that Perl is working by creating a little perl script and running it. Here is one that should work:

    print "Hello world!\n\n";
    print "Press the Enter key to exit.\n";
    <>; #pause

  3. Make sure that you Install IIS 7.0 with:
    Web Management Tools = IIS Management Console
    World Wide Web Services = CGI
  4. Once you have IIS running properly, go to http://localhost to check. You should get a default web page.
  5. Next, go into Control Panel
    = Administrative Tools
    = Computer Management (Local)
    = Internet Information Services (IIS) Manager
    = Default Web Site (or Default Web Site == cgi-bin if you set it up that way)
    = Handler Mappings
    = Add Script Map (once for CGI and again for Perl as per 6. and 7.)
  6. For CGI:
    Request path: *.cgi
    Executable: c:\Perl\bin\perl.exe "%s" %s
    Name: Perl Script Map
    Press 'OK'
    Say 'NO' to ISAPI message
  7. For Perl:
    Request path: *.pl
    Executable: c:\Perl\bin\perl.exe "%s" %s
    Name: CGI Script Map
    Press 'OK'
    Say 'No' to ISAPI message
  8. Restart IIS
    Control Panel
    = Administrative Tools
    = Services
    = World Wide Web Publishing
    = Restart the Service)
  9. Run a script that you know works. Don't do anything different until you are sure that IIS is running as expected.


1st Rate Articles

childrenofthedragon | Mon, 2007-04-23 00:13

Dear Earl:

I'm sorta newbie to all this stuff: i have just installed activeperl for Win vista, and have installed/enabled all components for iis7 on my window vista ultimate editin. when i try to run any *.cgi scripts, i keep on getting the "file save" dialogue from my you know what may be wrong? would really appreciate your help on this issue...i would be willing to elaborate further if required.


Bo Yang.

MarcRJacobs | Mon, 2007-04-23 07:17

I am receiving the error shown below. The code is a simple login form with a "method=post" command in the form. I tried all the above, and still can't make it work. The code worked in IIS 5, and also works up on our linux servers. Any ideas would definitely be appreciated.


Server Error in Application "Default Web Site"


HTTP Error 405.0 - Method Not Allowed
Description: The page you are looking for cannot be displayed because an invalid method (HTTP verb) is being used.

Error Code: 0x80070001

Notification: ExecuteRequestHandler

Module: StaticFileModule

Requested URL:

Physical Path: C:\sites\caboodle\pos\adminindex.cgi

Logon User: Anonymous

Logon Method: Anonymous

Handler: StaticFile

Most likely causes:

The request sent to the Web server used an HTTP verb that is not allowed by the module configured to handle the request.
A request was sent to the server that contained an invalid HTTP verb.
The request is for static content and contains an HTTP verb other than GET or HEAD.
A request was sent to a virtual directory using the HTTP verb POST and the default document is a static file that does not support HTTP verbs other than GET or HEAD.
What you can try:

Verify the list of verbs enabled for the module handler this request was sent to, and ensure that this verb should be allowed for the Web site.
Check the IIS log file to see which verb is not allowed for the request.
Create a tracing rule to track failed requests for this HTTP status code. For more information about creating a tracing rule for failed requests, click here.
More Information... This error means that the request sent to the Web server contained an HTTP verb that is not allowed by the configured module handler for the request.

Server Version Information: Internet Information Services 7.0.

textor | Fri, 2007-05-25 08:32

Very clear and useful. This has saved me hours of time.

However I still can't get perl to work and have posted a new question


textor | Fri, 2007-05-25 08:43

OK I fixed my problem. I switched form Perl.exe to perlis.dll.

Now it magically works.


textor | Wed, 2007-05-30 04:05

Here are some things I have discovered in porting a Perl Content management System from Unix to IIS which other may find useful:

At step 7:
1. Perl.exe didn't work for me at all.
2. perlex30.dll worked better but only some things were OK (I think it is like Mod_perl)
3. perlis.dll worked and programs developed for Unix originally seem to pretty much work out of the box.

Using perlis:

The information in the manual about turning the headers on or off using the registry entry EnableCGIHeaders doesn't seem to be correct.

You have to output ALL the mime headers you need. e.g.
print "HTTP/1.0 200 OK\nContent-type:text/html\n\n";

The perl error log including anything you print to STDERR is at c:\Perl\bin\PerlIs-Err.log

The shebang line is ignored but any switches in it are not. A program with -T in the shebang line failed to run and ran when I took it out. The error log wasn't very useful. -W stopped it running as well.


SlySi | Tue, 2007-07-03 15:18

Hi, On trying these guides under 64 the system will not allow the arguements "%s" %s in the path name. It claims invalid path. Have tried wrapping whole lot in quotes but it doesn't work. Am I missing something obvious?

Perl is in and running as it executes from command line fine, it's adding the modules to IIS7 64 that I'm stuck on.


rahuldj | Wed, 2007-10-10 21:23

Well... I followed the steps but couldn't get the script to run. Then (just for sake of experimentation) I clicked 'Yes' to the ISAPI message and that's it... It just started working!
Should I be concerned regarding this setting? Can I possibly have some issues with this?

fuzor_silverbolt | Sat, 2008-02-16 21:31

I think the part of saying no is incorrect. I have the perl.exe working on vista ultimate 32bit. The configuration requiremnets for vista IIS is similar to 2003 IIS. You must allow the module in the restrictions part of IIS.

Look at my two screenshots of my system. They should help you

Of course change perl path to where you installed perl on your system.

meowmee | Fri, 2008-05-30 16:35

I think it is IIS 6.0. Sorry, I am more of a developer than a network/system admin but I have to jump into this right now. I got IIS running on a Windows Server 2003 and for the life of me, I can't get Perl to work. I tried everything suggested but the last little part is always different for me than what's suggested and shown. For example, in that detailed step-by-step on setting up Perl in IIS Manager, what's Handler Mappings? I was able to set up the path and everything in IIS Manager -> domain (local computer) -> Web Sites -> virtual directory (Properties) and when the Properties windows, tab "Virtual Directory" and under "Application Settings", under "Starting Point" when you click on the "Configuration" button on the right.

Is that it? Or I shouldn't do this under Virtual directories?

Help please! I really don't want to develop this using ASP! This is why I am trying to get Perl to work on IIS!



hawk | Mon, 2009-08-10 08:43

I cannot begin to express my anger at Microsoft. IIS is horrible! Absolutely horrible!! And it gets worse each release!!

phoferer | Wed, 2011-06-15 19:49

I used this document to help with my IIS 7.00 system on Windows 2008 Server. It was a great help, thank you.

Oddly enough the DLLs using IsapiModule would only load the page, but would not run my scripting logic. I spent several hours trying to debug the script logic before figuring out that the problem was with the IIS 7.0 configuration.

I tried this change and my scripting logic started to work! I could actually code a web page that could call external commands which (by design) the asp web page I was originally coding could not. Thank you again for the simple tutorial.

David.Hiskiyahu... | Wed, 2012-07-04 03:10

At the end of step 6, whether I answer 'Yes' or 'No' to the ISAPI message, I am getting the following message back:

" [red X] The specified module required by this handler is not in the modules list. If you are adding a script map handler mapping, the IsapiModule or the CgiModule must be in the modules list. "

This is a IIS7.5 on a Window 2008 server.
The IIS itself functions - I can see static HTML pages OK.
Just cannot implement the mappings for *.cgi and *.pl, because this Isapi message blocks me either way, with Yes and with No in answer.

Please help!

ActiveState Staff
Mon, 2012-07-16 12:02

Which means that you haven't installed all the necessary modules inside of IIS 7.5.

By default IIS 7.5 will only install a minimal set.

You need to re-run the IIS installer, and add all the development tools.

turnerallee | Wed, 2013-06-19 06:24

I have completed all the steps above but keep getting the error below?

Can you help?

HTTP Error 502.2 - Bad Gateway
The specified CGI application misbehaved by not returning a complete set of HTTP headers. The headers it did return are "Can't open perl script