If you need to install a PHP on your local Windows machine with Internet Information Services (IIS), Microsoft has already provided a way where you can do it fairly quickly using WPI.
Keep in mind though, this setup has not been tested for production environment. So only use it as a PHP development environment for Windows.
Open Control Panel -> Programs and Features -> Turn Windows features on or off. Under Internet Information Services -> World Wide Web Services -> Application Development Features, make sure that option CGI is checked. This enables both the CGI and FastCGI services.
Download Web Platform Installer. For this example for Windows 10 64-bit, it’s the WebPI 5.0 x64.
Double-click on WebPlatformInstaller_amd64_en-US.msi to install it.
Once installed, you should see a file with the name wpilauncher.exe. Double-click it.
When you see the Window, click on the Products link and search for “php” and press ENTER.
Add PHP 7.0.9 (x64) (or later version if available) as an item to install. Selecting this will automatically add Windows Cache Extension and PHP Manager for IIS.
(Optional) If you need to connect to SQL Server using PHP, you need to install Microsoft Drivers 4.0 (x64) for PHP v7.0 for SQL Server in IIS.
Click on Install button.
The downside of this installation is probably WPI may have a mind on its own and install other components that you didn’t choose as shown below:
If you see a failed installation for PHP Manager for IIS like above, don’t worry about it. That component is only used to provide a GUI for managing PHP from IIS. You can still use the command line and text editor to make configuration changes.
As always you can always test your PHP installation by creating a test.php file with this PHP code.
<?php phpinfo(); ?>
And run it from your browser (i.e., http://localhost/test.php). If PHP is installed correctly, you will see something similar to this:
You may notice that the version of PHP installed using WPI is usually several versions behind the release version. Fortunately, you can always download PHP for Windows yourself and upgrade your PHP installation on Windows to a newer version with just a few additional steps explained on this post.
PHP for the Web: Visual QuickStart Guide (5th Edition)
Modern PHP: New Features and Good Practices
How to Upgrade to PHP 7.1 on Windows 10
How to Upgrade from PHP 7.1 to PHP 7.2 on IIS (Windows 10)
Using FastCGI to Host PHP Applications on IIS 7