By default, PHP is not enabled in IIS. Download the Microsoft Web Platform Installer:
- Go to the Microsoft Web Platform Installer 3.0 website
- Select the Free Download button
- Select Save
Using the Microsoft Web Platform Installer, install PHP.
- Go to your Downloads folder and run wpinstaller
- In the Web Platform Installer dialog box, select Products
- In the left panel, select Frameworks
- Select the version of PHP you would like to use, and select Install
Note: As of this writing (April 2016), install version 5.6 of PHP. Do not install version 7.0 of PHP, as version 7.0 does not yet have support for the SQL Server DLL.
- Select I Accept. PHP will be installed.
- After the installation has completed, select Finish and then select Exit.
To test PHP to see if it is working, in IIS select PHP Manager and then select Check phpinfo(). If the PHP Version page appears, PHP is working properly.
Follow these steps to open the directory where the default HTML, ASP.Net and PHP files will be stored.
- In IIS, expand the root folder
- Expand Sites
- Right-click Default Web Site and select Explore
- Windows Explorer opens the directory where the HTML, ASP.Net and PHP files will be stored. This may be C:\\inetpub\\wwwroot. In this folder, create a new file named phpinfo.php.
- Edit the phpinfo.php file and add the following PHP: <?php phpinfo().php ?>
- In a Web browser, navigate to http://localhost/phpinfo.php. The same PHP Version page that displayed in IIS should now be displayed in a Web browser. This confirms that PHP is working.
Note: HTML pages can be viewed as a file, such as file:///C:/inetpub/wwwroot/iisstart.htm. PHP pages cannot be viewed as a file, as PHP pages need to be rendered by IIS. This is why http://localhost/phpinfo.php must be used.