PHP的处理程序添加到网站,甚至只能通过AppCmd文件夹

我试图自动部署一个IISnetworking服务器(目前8.5,将需要一直工作到7.5以及),使用AppCmd.exe

我正在使用PHP的FastCGI来处理请求。 我已经在服务器级configuration了FastCGI池。

现在我需要设置一个新的处理程序来处理FastCGI模块的* .php请求。

PHP文档和各种微软文档都说这个AppCmd命令可以做到这一点:

%windir%\system32\inetsrv\appcmd set config /section:system.webServer/handlers /+ [name='PHP_via_FastCGI',path=' .php',verb=' ',modules='FastCgiModule',scriptProcessor='c:\PHP\php-cgi.exe',resourceType='Either']

来源: http : //php.net/manual/de/install.windows.iis7.php

虽然这确实起作用,但它也将处理程序放在服务器级别上。 虽然我需要处理程序在网站上。

我尝试了各种组合,最后拿出下面的命令:

set config "Default Web Site/" -section:system.webServer/handlers /+[name='PHP_via_FastCGI',path=' .php',verb=' ',modules='FastCgiModule',scriptProcessor='c:\PHP\php-cgi.exe',resourceType='Either']

这告诉我,configuration不能在这个层面上完成。

但是,当我使用UI来添加处理程序的网站,我可以做到没有问题。 所以我觉得我的命令还是错的。

我在这里做错了什么?

干杯和thx很多,Worp

试试这个:

 appcmd.exe set config "Default Web Site" -section:system.webServer/handlers /+"[name='PHP_via_FastCGI',path='*.php',verb='',modules='FastCgiModule',scriptProcessor='c:\PHP\php-cgi.exe',resourceType='Either']" /commit:apphost 

它仍然改变ApplicationHost.config而不是web.config,但只适用于一个站点。