-
Notifications
You must be signed in to change notification settings - Fork 149
Description
I'm using Windows Server 2012 R2 64Bit.
I noticed that after the first successful run of the resource I was getting this error:
[[xIisModule]PHPModuleMapping] Adding fastCgi.
Filename:
Error: Cannot add duplicate collection entry of type 'application' with combined key attributes 'fullPath, arguments'
respectively set to 'C:\PHP\php-cgi.exe, '
+ CategoryInfo : NotSpecified: (:) [], CimException
+ FullyQualifiedErrorId : System.Runtime.InteropServices.COMException,Microsoft.IIs.PowerShell.Provider.AddConfigu
rationCommand
+ PSComputerName : localhost
The cause of that error is that the handler mapping gets incorrectly added as a managed handler, instead of a module mapping due to a missing Module key/value pair. Renaming the 'Module' key to 'Modules' fixed the issue.
Current Hashtable used by Add-webconfiguration /system.webServer/handlers iis:\ for adding handler:
@{ Name = $Name Path = $RequestPath Verb = $Verb -join ',' Module = $ModuleType ScriptProcessor = $Path }
Producing this xml in applicationHost.config
<add name="PHP-FastCGI" path="*.php" verb="*" scriptProcessor="C:\PHP\php-cgi.exe" />
It should be:
@{ Name = $Name Path = $RequestPath Verb = $Verb -join ',' Modules = $ModuleType ScriptProcessor = $Path ResourceType = 'File' }
Resulting in
<add name="PHP-FastCGI" path="*.php" verb="*" modules="FastCgiModule" scriptProcessor="C:\PHP\php-cgi.exe" resourceType="File" />
Happy to submit a PR.