Install PHP on Windows Server 2012

  • Last updated on: 2016-01-14
  • Authored by: Rackspace Support

This article details installing, testing, and configuring PHP on the Windows Server 2012. The article uses the Microsoft Web Platform Installer (Web PI) method of installation. It does not cover the use case of installing PHP from source.


Successfully installing PHP on a Windows Server 2012 requires a prior installation of the IIS framework.

Installing PHP with Web PI

  1. Open the Web PI application from the following location on your filesystem.

    C:\Program Files\Microsoft\Web Platform Installer\WebPlatformInstaller.exe

Note: If the Web PI application is not currently installed it can be downloaded via the following link: Web PI

  1. Search for PHP.

  2. Select Add next to the version of PHP you wish to install and click Install.

Note: At the time of writing this is 5.3.19 and 5.4.9

  1. When prompted to Accept the License terms, review and click I Accept.

  1. Click Finish once the installation is finalized. The PHP runtime environment will be stored on your local file system at the following location:

    C:\Program Files (x86)\PHP\%version

Testing PHP

Once you have successfully installed PHP you can test its functionality with a few simple steps.

  1. Create a file using a texteditor and insert the following code snippit.

    <?php phpinfo(); ?>
  2. This code, when run, presents detailed information about the current PHP configuration of the local system. Save the file as ‘info.php’ in the IIS root directory.

Note: The default directory is C:\inetpub\wwwroot

  1. Open a Web browser and go to the following URL:


With PHP successfully installed a screen will be presented detailing the PHP configuration.

Note: This information can harmful in the wrong hands so please delete or move the info.php file once the installation is successfully tested.

Customizing PHP

Configuration parameters for PHP are stored in the php.ini file, which resides in the root of the local installation.

  1. Open File Explorer and path to the PHP configuration (php.ini) file.

Note: The currently loaded configuration file can be found by leveraging the phpinfo(); script in the Testing PHPsection

  1. Open the file with text editor and perform any necessary modifications.

Note: Explaining the php directives that can be modified is beyond the scope of this article. Those seeking additional assistance should consult the official PHP Manual.

  1. Save the file once you have completed modifications.

  2. Next, restart the IIS service to load any configuration changes. To do so, open the Server Manager from the task bar.

  3. From the Tools menu select Internet Information Services (IIS) Manager. Select the server on the right hand screen and click Restart in the Manage Server section.

Setting the Default Document

To ensure php content is served as the first option the default document setting within the IIS Manager needs to be modified. This section will detail how to modify the Default Document setting within the IIS Manager to perform just this.

  1. Open the Server Manager from the task bar.

  2. From the Tools menu click Internet Information Services (IIS) Manager.

  1. In the Internet Information Services (IIS) Manager select the server homepage.

  1. Double-click the Default Document option.

  1. Select the index.php option and move it to the top of the list.

  1. IIS will now serve index.php files from the wwwroot folder before all other document types.

Continue the conversation in the Rackspace Community.