PHP (or whatever) CGI configuration in web.config IIS
I recently developed an installer for a web application (Yes, Web Application with an Installer) using Wix Tool Set.
The wizard guides the user to obtain all the basic information the site need for the installation, and looks like below:
Using custom actions at the end of the installation I configured dynamically the IIS to handler CGI using the documentation, to configure FastCGI to Host PHP, Python, Applications . There are a lot of steps and development to achieve this results, but the problem is here:
I installed the application and everything works fine, but, if I uninstall or install another Instance or another WebApplication the handlers configure by IIS is like globally and always points to the first installed. (The problem occurs when I uninstall the application) The applicationHost.config located in C:WindowsSystem32inetsrvconfig that is the configuration of IIS has the "config" like global.
<handlers accessPolicy="Read, Script">
<add name="PHP-FastCGI" path="*.php" verb="*" modules="FastCgiModule" scriptProcessor="E:CIM_devbinphp-v5.6php-cgi.exe" resourceType="Either" />
<add name="CGI-exe_2" path="*.exe" verb="*" modules="CgiModule" resourceType="File" requireAccess="Execute" allowPathInfo="true" />
<add name="TRACEVerbHandler2" path="*" verb="TRACE" modules="ProtocolSupportModule" requireAccess="None" />
<add name="OPTIONSVerbHandler2" path="*" verb="OPTIONS" modules="ProtocolSupportModule" requireAccess="None" />
<add name="StaticFile2" path="*" verb="*" modules="StaticFileModule,DefaultDocumentModule,DirectoryListingModule" resourceType="Either" requireAccess="Read" />
</handlers>
My question is, is there any way to do this configuration for each web site into the web.config ? I've been trying all stuff without success.
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.
%windir%system32inetsrvappcmd.exe unlock config "SiteName/app1" -section:system.webServer/handlers
<?xml version="1.0"?>
<configuration>
<system.webServer>
<handlers>
<add name="PHPviaFastCGI" path="*.php" verb="*" modules="FastCgiModule" scriptProcessor="C:UsersaxputheDocumentsPHPphp-cgi.exe" resourceType="Unspecified" />
</handlers>
</system.webServer>
</configuration>
Note "local" this confirms that the setting is coming from your local web.config and not from the applicationhost.config file.
链接地址: http://www.djcxy.com/p/38358.html