PHP – How To Manually Install PHP on IIS 10.0 for Windows Server 2016

Installing PHP 7 on IIS Server 2016


This guide will take you through installing PHP7 on Server 2016.  This is what works for me after following many guides, so I thought I would write my own. PHP is required for many of the Open Source blogging apps or CMS Packages out there, but can be a bit fiddly to install.

I have had success using the IIS web platform components installer, but lately some requirements get left behind and things don’t work, so this is a quick and dirty manual guide.

So what’s needed, hop over to and pick up the latest version of PHP which at the time of writing is 7.1. I have used the VC14 x64 Non-Thread Safe version, which is recommended for use on Windows IIS.

Also required is the Visual C++ Redistributables for visual Studio, PHP based on VC14 requires the redistributables indicated below.


When PHP and the VC Redist package is downloaded Install the VC_Redistx64.exe, create a folder in the C drive called PHP7, and extract the downloaded PHP zip file to the folder. Open the PHP7 folder and copy the php.ini-development file and save it as php.ini. Open this file and make the following changes;

Fastcgi_impersonate = 1
cgi.fix_pathinfo = 0 (zero)
extension_dir = “ext”
errorlog = “c:\php7\php_errorslog”
Timezone = UTC (Or your time zone)


Enabling PHP Modules.

Further down the php.ini file we need to “un” comment loadable module that php requires to function

Un comment out following lines under Dynamic Extensions; then save the file. These are the minimum required if using a CMS with MySQL.

Add PHP to the Environment Variable Path statement

Click Environment Variables…

Select Path and then Edit…

Select New, this allows you to input a new “path variable” into the path, Type C:\PHP7

If desired you can move the new entry up the list. This will put it closer to the start of the Path variable, but is not necessary. 

Click OK, OK, OK.  Restart the server

A quick check that things are on track can be achieved by opening PowerShell and typing php –info

If you get a screen full of output, like below, then things are looking good


Install IIS

Install IIS ensuring the CGI option is selected 

Some features may need the Server OS DVD in the drive or the ISO mounted if doing this in a Virtual Machine as an alternate source path is needed to be specified for some features. The scrip here will install all the features and roles BUT, assumes your CD/DVD is Z:\ and that you have either, a second partition on your drive labelled as D:\ or a second drive installed, labelled as D:\  Edit the script as necessary. Some things the script does is to create a new Inetpub\wwwroot folder on D:\ and copies all the c:\inetpub\wwwroot data to the new folder then deletes the C:\inetpub\wwwroot. IF you don’t have a second drive or partition configured parts of the script will fail.


Add a Module Mapping

Once IIS is installed, open up IIS Manager and open the Handler Mappings.

Double click Handler Mappings


On the right-hand side menu, select Add Module Mapping…


Fill in the required information




Select Request Restrictions…

Ensure the following selections are as shown

On the Mapping Tab

On the Verbs Tab

On the Access Tab

Click OK, OK

When presented with the CGI application notification

Click Yes


Restart the Server

When the server is back up and running, create a text file with the following



Save this file in the Inetpub\wwwroot folder as Index.php ensure there is no .TXT extension. When saving the file as shown

Add Index.php top the IIS Default Document list.

Open IIS Manager, select the Server, and then select Default Document

Double click Default Document

Click Add…In the Add Default Document type Index.php, click OK

The new default document will appear in the list of documents.

Now it’s time to test our install. Open a web browser and go to http://localhost/ all being well you should be presented with the php configuration output


That’s it, your server is now configured to deliver pages using PHP…..

Adding Tools to our Linux Deployment

Adding Parted Magic to your WDS Server.

Read prior to configuring the server to have an idea of what you are doing and gain an understanding prior to commencement.

If you are reading this, then I assume (good or bad) that you have read my guide on setting up a Windows 2012R2 WDS Server and played with deploying Linux as described in the article.

There is nothing special about using WDS as all we are basically providing is a PXE Boot server that has been configured to allow us to deploy Windows based images or a couple of Linux flavours.

Now, some may like other types of things, so this is where the “Tools” come in.

Parted Magic as we all know is a disk partitioning tool that actually runs GParted. It also contains a Disk Imaging tool based on Clonezilla.

I was going to include adding Clonezilla but Parted Magic is a little easier to get going and doesn’t rely on NFS shares or the like, as all the required bits will be situated in the 

RemoteInstall\boot\x64\linux path.

OK, let’s begin, what’s needed; PMagic_2016_03_02.iso from or anywhere else. This is the latest copy I could find that was free. This page also has information on Computer requirements for running Parted Magic.

If this PMagic_2016_03_02.iso is not the one used, changes must be made to the section of the tools menu that loads the ISO.

This line INITRD LINUX/PMagic/pmagic_2016_03_02.iso in the must be edited to reflect the ISO used

Setting up the PMagic folder.

Drill down to the RemoteInstall\boot\x64 folder, and we should already have a sub folder called Linux where we set up Ubuntu and Centos. Make a folder called PMagic and extract the downloaded PMagic_2016_03_02.iso. Also place a copy of the ISO in this folder as shown

The PMagic Folder under Linux

Contents of the PMagic Folder

NOTE: Prior to booting up into Parted Magic, we need to edit the Syslinux.cfg located in the PMagic\boot folder. Open in notepad and replace vmalloc=512Mib with vmalloc=600MiB. I just did all instances.

The first time I booted into PMagic I was presented with an error along the lines of Increase vmalloc in the syslinux.cfg to equal the ISO size plus 32MiB. 600MiB is a nice round figure

From the previous post on deploying Linux from WDS, we should have 2 files in the RemoteInstall\boot\x64\pxelinux.cfg folder. The default file and the

When the client PC or VM is PXE booted we are presented with the new Boot menu as previously configured. 

Selecting =DISK TOOLS= gives us the Disk Tools Menu

From here we can select Part’d Magic Full ISO tool.

Selecting Part’d Magic Full ISO will start the process of booting the ISO to a live environment

 As Clonezilla is in the menu, I will cover it quickly. 

What’s required? or ISO or * I had a version earlier than the 20161024 and had no mouse, it just sat in the middle of the screen. 

Create a Clonezilla folder in the following location RemoteInstall\boot\x64\linux

Create a Clonezilla folder in the {drive:\Linux-distributions}
Extract the ISO or zip file to the Clonezilla folder. Copy the Live folder to the RemoteInstall\boot\x64\linux\Clonezilla folder.

Copy the vmlinuz file from the live folder back up to the RemoteInstall\boot\x64\linux\Clonezilla folder

This needs to be done as kernel load line for clonezilla looks like this: Kernel Linux/Clonezilla/vmlinuz


Edit the to this: Kernel Linux/Clonezilla/live/vmlinuz and it will work.


Good luck