Technology Blog

Installing PHP on Windows Server 2012


This article will detail installing, testing, and configuring title=”View all articles about PHP here”>PHP on the title=”View all articles about Windows here”>Windows Server 2012. This article will use the Microsoft Web Platform Installer (Web PI) method of installation. It will 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. Step by step instructions detailing installing IIS 8.0 on Windows Server 2012 can be found in the following knowledge center article.


Installing PHP with Web PI

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

C:Program FilesMicrosoftWeb Platform InstallerWebPlatformInstaller.exe

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

2. Search for PHP.

3. 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

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

5. 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:inetpubwwwroot

3. 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 PHP section

2. 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.

3. Save the file once you have completed modifications.

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

5. 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.

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

4. Double-click the Default Document option.

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

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