title: PHP (or whatever) CGI configuration in web.config IIS
body: <p>I recently developed an installer for a web application (Yes, Web Application with an Installer) using <a href="http://wixtoolset.org/">Wix Tool Set</a>. </p>
  
  <p>The wizard guides the user to obtain all the basic information the site need for the installation, and looks like below:</p>
  
  <p><a href="https://i.stack.imgur.com/Mei9S.jpg"><img src="https://i.stack.imgur.com/Mei9S.jpg" alt="enter image description here"></a></p>
  
  <p>Using custom actions at the end of the installation I configured dynamically the IIS to handler CGI using <a href="https://technet.microsoft.com/en-us/library/dd239230(v=ws.10).aspx">the documentation</a>, to configure FastCGI to Host PHP, Python, <strong>Applications</strong>. There are a lot of steps and development to achieve this results, but the problem is here:</p>
  
  <p>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 <em>applicationHost.config</em> located in <em>C:\Windows\System32\inetsrv\config</em> that is the configuration of IIS has the "config" like global.</p>
  
  <pre><code>&lt;handlers accessPolicy="Read, Script"&gt;
              &lt;add name="PHP-FastCGI" path="*.php" verb="*" modules="FastCgiModule" scriptProcessor="E:\CIM_dev\bin\php-v5.6\php-cgi.exe" resourceType="Either" /&gt;
              &lt;add name="CGI-exe_2" path="*.exe" verb="*" modules="CgiModule" resourceType="File" requireAccess="Execute" allowPathInfo="true" /&gt;
              &lt;add name="TRACEVerbHandler2" path="*" verb="TRACE" modules="ProtocolSupportModule" requireAccess="None" /&gt;
              &lt;add name="OPTIONSVerbHandler2" path="*" verb="OPTIONS" modules="ProtocolSupportModule" requireAccess="None" /&gt;
              &lt;add name="StaticFile2" path="*" verb="*" modules="StaticFileModule,DefaultDocumentModule,DirectoryListingModule" resourceType="Either" requireAccess="Read" /&gt;
          &lt;/handlers&gt;
  </code></pre>
  
  <p>My question is, is there any way to do this configuration for each web site into the <strong>web.config</strong>? I've been trying all stuff without success.</p>