PHP (or whatever) CGI configuration in web.config IIS

人走茶凉 提交于 2019-12-04 03:40:53
Isaiah4110

So if I understand it right, you want to move php handlers from server/website level to individual applications. Why dont you add a web.config file within your php application folder and move the application specific handlers there.

  1. https://stackoverflow.com/a/35332431/1766402 - check this answer (I am hoping you have CGI enabled in IIS?). To do this via wix, can you add the following command within a custom action and execute. This will unlock the parent config file.

%windir%\system32\inetsrv\appcmd.exe unlock config "SiteName/app1" -section:system.webServer/handlers

  1. Within the PHP application folder (let's say c:\php\app1) create a web.config file with the following content:

<?xml version="1.0"?>
<configuration>
    <system.webServer>      
        <handlers>
            <add name="PHPviaFastCGI" path="*.php" verb="*" modules="FastCgiModule" scriptProcessor="C:\Users\axputhe\Documents\PHP\php-cgi.exe" resourceType="Unspecified" />
        </handlers>
    </system.webServer> 
</configuration>
  1. Now if you look at your application within IIS Manager you should see something like this (App Dir -> Handler Mappings)

Note "local" this confirms that the setting is coming from your local web.config and not from the applicationhost.config file.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!