IIS 7 and Above
Configuration & Scripting
Host Perl on IIS 7 By CGI , windows serveice 2008 sp1 64x. Get result...
Last post Jul 16, 2011 07:21 PM by HCamper
May 31, 2011 04:00 AM|felixz|LINK
I have just installed activeperl for Windows service 2008 sp1 64x, and have installed/enabled all components for iis7 on it.
I have enable IIS CGI, and set the "script map"
1. Request path: *.pl
Executable: c:\Perl\bin\perl.exe "%s" %s
Name: Perl Script (PL)
Click Yes on the "enable ISAPI message"
2. Request path: *.cgi
Name: Perl Script (CGI)
Click Yes on the "enable ISAPI message
when i try to run any *.pl scripts, i keep on getting the "file save" dialogue from my ie...do you know what may be wrong? would really appreciate your help on this issue...i would be willing to elaborate further if required.
May 31, 2011 06:32 AM|felixz|LINK
I try it in windows 7 enterprise, with IIS 7.5
if I use localhost, the script work.
but when I use machineName in URL, the "file save" dialogue show again.
May 31, 2011 07:29 AM|HCamper|LINK
Have you checked this
for perl install?
Question when you ran the Active State perl install did you say yes to create a Windows File Association?
If you created the Windows File Association re run the installer and un-select the File Association.
And check Wade guide for steps to create the handler and for perl you need a *.cgi and *.pl
mapping along with enable the execution of "cgi" which by default is disabled.
For your perl scripts and IIS Server make sure the first output is Content: "text/plain"; other wise
you will get gateway errors on execution.
Additionally you need to add the IUSR IIS_USERS permissions to the perl directories.
May 31, 2011 08:32 AM|felixz|LINK
Thanks for you response.
Let me check the link you just give to me.
May 31, 2011 09:07 AM|kctt|LINK
You can try mapping Isapimodule -> C:\Perl\bin\PerlEx30.dll
May 31, 2011 09:10 AM|felixz|LINK
I think the reason is I use the Perl 64
now Im trying to install the perl 32 5.12.3
May 31, 2011 09:23 AM|HCamper|LINK
Yes, There are many problems with using Perl X64 versions it is better to use Perl X86.
May 31, 2011 09:42 AM|felixz|LINK
I follow the link what you send to me.
install the perl X86
at hendler mappings, I add the Module Mapping that "*.pl" mapping to "C:\Perl\bin\PerlEx30.dll"
and remove the script map that "*.pl" mapping to "C:\Perl\bin\Perl.exe "%s" %s"
I get 500.0
in detail it say "The authenticated user does not have permission to use this DLL."
but, I already add the IIS_IUSRS user to C:\Perl User
May 31, 2011 09:47 AM|felixz|LINK
by the way,
the perlex30.dll cannot add "%s" %s"
May 31, 2011 09:51 AM|felixz|LINK
it seems not just because 64bit activeperl.
after I install the activeperl.
add the perlex30.dll module mapping. the server return 500.0
and if I add perl.exe "%s" %s script mapping. the localhost work correct.
but if I use my machinename in url, will pop the download box
May 31, 2011 10:10 AM|HCamper|LINK
Check this post also
As I posted early on you have two account that require access IUSR then IIS_USRS permissions to the perl directories.
The IUSR and IIS_USRS need to have permissions in IIS Server and the Web Sites for access
the permissions are read,execute,list.
The IUSR and IIS_USRS need to to have permissions and access to the C:\Windows\Temp folders
and require read,execute,list and write.
In addition to the permissions check that the perl path is after the C:\Windows...\ and not before C:\Windows...\
you will experience very slow start up of the windows system the path also prevents checking for Windows Commands to
use to open perl or other files.
May 31, 2011 10:47 AM|felixz|LINK
Let me check the link you send to me.
Jun 01, 2011 03:45 AM|felixz|LINK
Thanks for your response at first.
unfortunately, the script still not exec when the url not localhost.
It pop the savefile dialogureBox
I follow these step:
1. install perl -- ActivePerl-126.96.36.1994-x86,
2. perl install Path: C:\Perl
3. set IUSR and IIS_IUSRS permissions, read,execute,list for C:\Perl
4. Add CGI to Role "Web Server(IIS)"
5. Create perl file "perlhelloworld.pl", which include "print "Content-type: text/plain\n\n";"
6. Add Module mapping, Request path: *.pl ; executable c:\Perl\bin\perlex30.dll
7. Set IUSR and IIS_IUSRS permissions, read,execute,list for this web site
8. Set IUSR and IIS_USRS permissions C:\Windows\Temp folders, read,execute,list, write
9. Set the DefaultAppPool , Enable 32-Bit Applications : true
1) I still set the DefaultAppPool, .netframework : v4.0 ; Identity : NetworkService ; Load User Profile : false
2) I remove the CgiModule Handler mappings.
Jun 01, 2011 09:04 AM|felixz|LINK
when I set isapimodule and cgimodule, the locahost link work
but, after I replace localhost to server name, the perl script will not exec but pop a download dialogure box.
and, isapimodule can not follow paramteters. its means localhost?XXX not work in isapimodule
Jun 01, 2011 01:35 PM|HCamper|LINK
The current failures likely are " DefaultAppPool, .netframework : v4.0 ; Identity : NetworkService ; Load User Profile : false"
change the Application Pool settings to Net 2.0 Framework and select Classic Mode and select the Identity.
Undo the setting for Set the DefaultAppPool , Enable 32-Bit Applications : true.
Check this guide for settings http://www.iis.net/ConfigReference/system.applicationHost/applicationPools/applicationPoolDefaults .
And use this for operations
General Note: You can have several Handlers and mappings for perl to use CGI and SCRIPT you create
each with unique name and settings.
Jun 02, 2011 03:24 AM|felixz|LINK
Thanks Martin again.
I set the Default AppPool as you said.
but my current VM is windows server 2008 sp1
I cannot find the "ApplicationPoolIdentity " in the Identity drop down box in the pool advance setting.
I think it just in 2008 sp2.
So, my current setting is like below
.net framework version : v2.0
Enable 32-bit applications : true
Managed Pipeline Mode : classic
Identity: LocalService (I use this setting, because as I know this setting has the most powerful)
Load User Profile: False
But the result is nothing changed.
So, I try everything in my local machine (window 7 enterprise, IIS 7.5)
I set Isapi mapping and CGI mapping.
and the pool setting is totally same to you said.
below is my test:
I get result :
Press the Enter key to exit.
I get result :
A pop box. title is : Do you want to open or save PerlHelloWorld.pl (43 bytes) from myServerName? (in Server 2008 sp1 always get this result, even I use local host)
Below is my PerlCode:
print "Content-type: text/plain\n\n";
print "Hello world!\n\n";
print "Press the Enter key to exit.\n";
Jun 03, 2011 10:37 AM|felixz|LINK
Why the perl host on IIS work correct in LocalHost url.
And not work in the ServerName URL
Is there the reason not the handler mapping but the IIS publish issue?
Jun 03, 2011 02:41 PM|HCamper|LINK
General Note: For Web Servers and Script Engines have pretty much the same requirements for operations:
A ) A fully defined path to the Script Engine.
B) A short path to the Script Engine.
C) A method to deliver proper headers for first request.
D) A method to allow passing parameters as part of the Scripting Engine.
The format for parameters and passing values follow the general
rules for C, C++ and Main Function .
E) A mapping of an extension or Mime type that is a form of request for files.
F) Enabling the Web Server to allow the execution of the Script Engine.
G) Security restrictions for User Accounts, File System access that are in effect to protect the System.
H) The items A-G are true for PHP,Perl, Ruby,Python and others.
I) There may be variations for types of Web Servers, but you can generalize that A-G must be handled first.
The problem is likely that you have not enabled the Handler in IIS Server or in the location the script is running from.
Yes The items A-I from above are a long description for rules. If you use A-I as a general Work Flow all the scripting engines
Jun 07, 2011 08:05 AM|felixz|LINK
Now, I set the website ISAPIFilters
after all ISAPIFilters setting, I reset iis
Access the perl file by IE again.
the download Dialogure box has gone.
but, I get new error. like below
I have check the Perlis.dll permissions. I have add the IUSR and IIS_IUSRS , and give them full control right.
Error Summary :
Detailed Error Information
Most likely causes:
Things you can try:
<?xml version="1.0" encoding="UTF-8"?>
<add value="PerlHelloWorld.pl" />
Jun 07, 2011 10:46 AM|felixz|LINK
The Location section in applicationHost.config is like below:
<location path="Default Web Site/perlTest">
<remove name="CGI-exe" />
<remove name="ISAPI-dll" />
<remove name="Perl Script (PL)" />
<remove name="Perl Script (CGI)" />
<add name="ActiveState Perl for .pl" path="*.pl" verb="*" modules="IsapiModule" scriptProcessor="C:\Perl\bin\PerlEx30.dll" resourceType="Either" requireAccess="Script" preCondition="bitness32" />
<location path="Default Web Site">
<remove name="Perl Script (PL)" />
<add name="Perl Script (PL)" path="*.pl" verb="GET,HEAD,POST" modules="CgiModule" scriptProcessor="c:\Perl\bin\perl.exe "%s" %s" resourceType="Unspecified" />
<add name="Perl ISAPI" path="*.pl" verb="*" modules="IsapiModule" scriptProcessor="C:\Perl\bin\perlis.dll" resourceType="Unspecified" preCondition="bitness32" />
<filter name="PerlIsapiFilter" path="C:\Perl\bin\perlis.dll" preCondition="bitness32" />
Jun 07, 2011 04:32 PM|HCamper|LINK
When you add directories "C:\TextCatIIS\" that are not in IIS Server
you need to manually add the permissions for the IUSR and IIS_USRS or other accounts.
Also do not add the perl script as default document.
For the handlers remove current or duplicate entries.
Currently you need to restore the handler that installer created.
Default or basic mapping of *.pl and point to "C:\Perl\bin\perl.exe" "%s" %s with name "Perl Script"
restrictions of file with verbs Get,HEAD,POST and execution as script.
After the settings have been set go to the Web Site you created TextCatIIS and enable the handler.
Check the ISAPI Restrictions pane and check that there is a single entry with the path and parameters from above.
Check your test script.
If the test script works then you can add addtional ISAPI mapping as shown in the guide.
You can have mappings for Perl to handle file or file & folder each with Unique Name and types of actions or restrictions.
Yes, The steps for creating handlers and mapping's can be confusing at first. You can make this work.
Jun 08, 2011 08:22 AM|felixz|LINK
Thanks HCamper for you response me.
I have create a "perltest.pl" file in "C:\inetpub\wwwroot" location
My current environment :
After that, I do follow steps:
Base on these step:
What I want is get the result when I use Mechina Name to access IIS
This issue follow me like a ghost almost a week, its very strange I have try all the setting.
Thanks for your help again.
Jun 08, 2011 10:27 AM|felixz|LINK
It looks like
if I use CGI, the handle mapping not working when the URL link not use localhost but serverName
if I use ISAPI, its just work in ISAPI Filters, and the perlis.dll can not be access.
Jun 08, 2011 06:44 PM|HCamper|LINK
You have to check the subtle differences
using the path to Perl as "C:\Perl\bin\perl.exe" "%s" %s
with proper quotes is different than C:\Perl\bin\perl.exe "%s" %s .
Note: The handlers appear in two places in Features View the Machine and Default Web Server.
After you make the handler changes you need to enable the handler in the Default Web Site.
The 500 error is permissions problem for the Default Web Server for Application Pool and or Identity used.
Check the link for Perl and Buzilla there is a picture showing the ISAPI restrictions and the
path to Perl will appear in that location you need to check that there are no un-named duplicates and path is correct.
Jun 09, 2011 03:12 AM|felixz|LINK
Thanks for you response Martin,
I have try the path "C:\Perl\bin\perl.exe" "%s" %s
but, give me same result.
and I find in the before, I have not set the machine handle mapping.
after I set the handle mapping in machine part.
it returns same result too.
after them all,
1. I remove the perl script mapping
2. I add module mapping
"C:\Perl\bin\perl.exe" "%s" %s
3. I get 500.0 result
Jun 09, 2011 03:24 AM|HCamper|LINK
I suggest you check the Jetstat @ dot com web site
they have a free dignostics tool called ASP Diag.
The diag tool can be used to check server variables PHP and perl.
The Asp Diag may help you work out the perl issues.
General Disclaimer: The ASP Diag is not a Microsoft Supported Product.
For a Microsoft Supported note check this
The 500 error is not that usefull look at list
so use this guide
To get more details for the types of errors.
Hope this gets you going.
Jun 09, 2011 04:02 AM|felixz|LINK
in the post "Running Perl on IIS 7 "
"Sometimes, though, the right tool for the job is not the newest and flashiest thing. It turns out that this is the case for Perl. For many years,
ActiveState has provided a free version of
ActivePerl that runs great on IIS using ISAPI instead of FastCGI."
So, is there use ISAPI is better than FastCGI in host perl on iis?
Jun 09, 2011 04:39 AM|HCamper|LINK
If you look later in the post additional notes:
"There are at least two different ISAPI extensions with ActivePerl"
"You should make sure that you use PerlEx30.dll with IIS 7."
"If you use perlis.dll, you may find that response headers sent from your Perl script are added to your response page instead of going back to the client as headers."
His conclusion was the Active state ISAPI runs great in comparision to FastCGI and perl.
You can have both the ISAPI and FastCGI handlers with mappings using different names and types of access.
The current problem is getting at least one of the possible (pl cgi) Handlers and Mappings working for Web Server settings then in Web Sites.
The Perl Script Handler using a *.pl or *.cgi map with path to perl.exe
*.pl path to perl dll then you need to enable in Machine aka IIS Server then enable in Web Site and set the correct permissions.
The Microsoft Support article maybe words the steps better that the post by Wade ?
Jun 09, 2011 06:41 AM|felixz|LINK
Now , the helloworld.pl is work correct in windows 7 and IIS 7.5 with CGI.
I remove the Perl, and matnual remove c:\perl folder.
after that I reinstall the perl,
1. not select PPM
2. uncheck all of the options prompted
3. enable all feature under "Internet Infomation Services"
Jun 09, 2011 10:32 AM|felixz|LINK
I follow this link
setting my windows server 2008 IIS 7.0
and the perl is work now.
detail setting is below:
Jun 09, 2011 03:18 PM|HCamper|LINK
Hey @ felixz,
Glad you got the perl going.
Jul 14, 2011 12:37 PM|steve schofield|LINK
Thanks for the handy reference thread. I was able to get PERL running. Anyone know how to secure for shared hosting?
visit this thread.
http://www.iislogs.com/steveschofield/hosting-perl-on-iis-7.x-thread (blog I wrote referencing this thread!)
Windows Server MVP - IIS
Log archival solution
Install, Configure, Forget
Jul 16, 2011 07:21 PM|HCamper|LINK
Hello @ Steve,
The previous suggestions comments for this
for Perl and Shared Hosting have been moved to
a New Post in PHP Community Forum.