0

I am trying to automatically deploy an IIS webserver (currently 8.5, will need to work it out all the way down to 7.5 as well), using AppCmd.exe

I am using PHP's FastCGI to handle requests. I have configured the FastCGI pool on server level.

Now I need to set up a new handler to handle *.php requests with the FastCGI module.

The PHP documentation and various Microsoft docs say that this AppCmd command will do it:

%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']

source: http://php.net/manual/de/install.windows.iis7.php

While this does in fact work, it puts the handler on server level as well. I need the handler to be on website level though.

I have tried various combinations, finally coming up with the following command:

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']

Which tells me that the configuration cannot be done on this level.

However when I am using the UI to add the handler to the website, I can do it with no problems. Thus I think my command is still wrong.

What am I doing wrong here?

Cheers and thx a lot, Worp

Worp
  • 337
  • 2
  • 4
  • 16

1 Answers1

1

Try this one:

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

It still changes ApplicationHost.config rather than web.config but only applies to one site.