PHP

Install PHP on IIS Windows Server – Web Platform Installer

Install PHP in IIS WIndows Server with Microsoft Web Platform Installer to run PHP applications.

PHP is the popular server-side programming language to build websites and web applications. Most of the web hosts supports PHP and has good collection of libraries to cut the development time. But it is not supported by IIS out-of-the-box.

Why PHP in IIS?

There are many all-in-one packages for Windows distribution that contain Apache, PHP, MySQL and other applications to test and run PHP applications in Windows machine (eg. XAMPP, WAMP). But it may not be feasible to install those distributions on already running IIS Server. We can use windows distributions of those packages in our local windows machine for development and testing purpose but we will install PHP than all-in-one package in IIS Windows Server.

Microsoft Web Platform Installer

Microsoft Web Platform Installer is a freeware to simplify the workflow of installing common open source web applications and web platform technologies. It simplifies download, install and keep up-to-date with the latest components of the Microsoft Web Platform. Download and install the package.

Install PHP and PHP Manager

We can install PHP 7 for windows using Microsoft Web Platform Installer. We can install PHP manually but then we will have to handle many more dependencies manually.

Microsoft Web Platform InstallerAfter installing Micorsoft Web Platform Installer, to access it, go to Start menu, open Server Manager, then in to Tools menu, select Internet Information Services (IIS) Manager.

Windows Server Manager

In IIS Manager window, under Manager section, double click Web Platform Installer to open. Here we can search for the required PHP version package and proceed for installation. Here we install required PHP version and PHP Manager packages. PHP Manager is a tool to manage PHP installed in the system in easy way. We can even manage different versions of PHP for different application hosted in IIS Server.

Web Platform Installer

After installing PHP and PHP Manager, open PHP Manager where we can view installed PHP installation details and also make required changes in PHP configuration.

 PHP Manager

PHP Manager

From PHP Manager we can enable or disable the extensions as per the requirement. PHP Extensions

Some of the task are handled by PHP Manager for getting PHP up and running on IIS Windows Server.

And we are ready to run our first PHP application in IIS Server. Go to the site folder in Server where all the hosted website/applications are located (C:/inetpub). Create a new folder and create a test php script file (Eg. index.php) with content

<?php
echo "Hello World";

Then add the dite to the server. And from the browser, browse to the site you just created. You must get the page with the content “Hello World”.