PHP Manager for IIS fails to install
When attempting to integrate PHP into an existing IIS 8 environment, you might encounter a scenario where the installer appears to complete successfully, only to be met with an immediate failure upon restart or configuration application. The error you are seeing typically indicates that the IIS management tools cannot register the new module, often because the required handler mappings were not flushed correctly or the application pool recycling logic is blocking the change.
The root cause usually lies in how the PHP Manager interacts with the mod_php5 or mod_fastcgi modules. If you have previously installed a different version of PHP or used a legacy configuration like php.ini, residual handler mappings often persist in the IIS configuration store (applicationHost.config). When the installer tries to write its own handlers, it fails silently if it cannot overwrite these existing entries due to permission issues or conflicting registry keys.
Flushing Handler Mappings
Before running the PHP Manager again, you must ensure that IIS is completely empty of previous PHP handler registrations. The most reliable method to achieve this is by manually flushing the mappings via the command line using appcmd.exe.
Navigate to your server's root directory and run the following commands. This process removes any lingering FastCGI or ISAPI extensions associated with PHP:
# Flush all PHP handler mappings from the default web site and application pool
appcmd.exe delete config.system.webServer.handlers -section:"handlers.*"
appcmd.exe delete config.system.webServer.modules -section:"modules.*"
After executing these commands, restart the IIS services to ensure the changes take effect immediately:
iisreset /restart
If you are deploying PHP via FastCGI (which is recommended over ISAPI for modern setups), verify that the php-cgi.exe path in your application pool settings matches the actual binary location. A mismatch here causes the worker process to fail to start, resulting in a 500.19 error or a blank page.
Registry and Module Conflicts
In some cases, the installer fails because it attempts to register itself as a module, but IIS already has a conflicting entry from a different PHP version. You can inspect this by checking the registry under HKLM\SYSTEM\CurrentControlSet\Control\Class\{50A7341B-6D8E-429C-913F-7817597F7817}. Look for keys related to php_isapi or php_cgi. If you see duplicate entries with different CLSID values, delete the older ones manually before retrying the installation.
Another common pitfall involves the application pool identity. If your application pool runs under a restricted account that lacks read/write access to the PHP directory, the installer may succeed in writing files but fail when trying to register the module handler. Ensure that the pool identity (e.g., ApplicationPoolIdentity or a specific domain user) has full control over the folder containing php-cgi.exe.
Configuration Best Practices
Once the installation succeeds without errors, remember that simply installing PHP does not automatically configure it for IIS. You must still define the correct MIME types and rewrite rules. For instance, ensure that .php extensions are mapped to the application/x-httpd-php content type in the system.webServer/staticContent section of your configuration.
Additionally, if you plan to use modern PHP versions with IIS 8, consider switching from mod_php entirely to using a reverse proxy setup or leveraging the built-in PHP-FPM interface via FastCGI. This approach decouples the web server from the PHP interpreter, allowing for better resource management and scalability compared to loading the entire PHP engine into every IIS worker process.
For more advanced deployment strategies involving Laravel applications on IIS, you may find additional configuration guides at https://laravelcompany.com, particularly regarding how to handle session storage and file permissions in a Windows environment. However, for standard PHP installations, sticking to the manual flushing of handlers and verifying registry entries is the most robust path forward.