How to create a PHP page in IIS

Home > Search > How-to
  by

By default, PHP is not enabled in IIS. Download the Microsoft Web Platform Installer:

  1. Go to the Microsoft Web Platform Installer 3.0 website
  2. Select the Free Download button
  3. Select Save

 

Using the Microsoft Web Platform Installer, install PHP.

  1. Go to your Downloads folder and run wpinstaller
  2. In the Web Platform Installer dialog box, select Products
  3. In the left panel, select Frameworks
  4. 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.

  1. Select I Accept. PHP will be installed.
  2. 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.

  1. In IIS, expand the root folder
  2. Expand Sites
  3. Right-click Default Web Site and select Explore
  4. 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.
  5. Edit the phpinfo.php file and add the following PHP: <?php phpinfo().php ?>
  6. 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.

 



Add a Comment




We will never share your name or email with anyone. Enter your email if you would like to be notified when we respond to your comment.




Please enter in the box below so that we can be sure you are a human.




Comments