report

How to setup IIS 8 and PHP on Windows Server 2012

Installing the Web Server

In this guide, I will be installing Internet Information Services (IIS) 8.0 as the primary web server.

To begin, make sure you have the Server Manager panel open. On a default Windows Server 2012 configuration, the Server Manager will open at system boot, but you can also find it in the Taskbar or via the Start Menu by typing Server Manager.

Once in the Server Manager, navigate to the Dashboard page and select "Add roles and features" from the Quick Start panel. If you do not have the Quick Start panel available, you can select the option from the Manage menu in the top right corner of the server manager.

Once selected, the Add Roles and Features Wizard will appear. It's important to read the "Before you Begin" section here and make sure that you've done the following steps before proceeding:

  • Set a strong password for the Administrator account.
  • Network setting configuration.
  • Installed the latest updates from Windows Update.

When you are ready to proceed, press Next. For this installation, we will select the "Role-based or feature-based installation" option.

The options above are marked as (Installed) because I already completed the installation prior to taking the screenshot.
The options above are marked as (Installed) because I already completed the installation prior to taking the screenshot.

Next, you will need to select your server in the Server Pool (not a virtual hard disk).

After proceeding, you will be prompted to select the Server Roles you would like to queue for installation. Scroll down the list and find "Web Server (IIS)", and select it. Under the Web Server (IIS) category there is also an option for an FTP server. If you would like to be able to access your files over FTP you may select this option now.

The next panel is the Features panel. Here you can select any additional features you would like to install alongside your web server. For most average users, no additional options need to be selected. You may notice a few options in this list are already selected for you, most likely because they are prerequisites for the IIS installation.


After confirming your selection, the installation procedure will begin. This usually takes anywhere from 5-10 minutes but can fluctuate depending on the quality of the hardware and network connection.

When the installation is complete, you will need to issue a server restart to finalize the changes and start the IIS service.

After the reboot is complete, you should see the IIS panel now available under the Server Manager. You can confirm that the web server defaults are configured and working by navigating to http://127.0.0.1 in your web browser to see if the IIS 8 splash page is displayed.

The server is listening on port 80 and displaying the static splash page correctly!
The server is listening on port 80 and displaying the static splash page correctly!

Microsoft Web Platform Installer

Installing PHP through the Microsoft Web Platform Installer (WPI) is very straightforward. I would recommend using the WPI over attempting a manual installation of PHP for several reasons:

  • WPI picks the correct and latest version of PHP for you
  • WPI handles the default configuration and IIS integration
  • WPI allows you to easily update PHP at any time
  • WPI allows you to easily install PHP extensions without messing with configuration files

WPI does provide a layer of abstraction between the user and the configuration files, which some people may be uncomfortable with. If you are one of these people and would prefer to install PHP manually, you can skip this section because I touch up a little on how you'd go about a manual installation below.


To continue, first download the Microsoft Web Platform Installer and run it on your server.

Installing PHP

After running the WPI, navigate to the Products tab and select the Frameworks tab on the left.

Browse the list until you find the PHP option.

After pressing Add, go ahead and select Install.

Before the actual installation takes place, WPI will make sure you meet all the prerequisites. After accepting the terms the installation process will begin.

When the installation is finished, you will be prompted with a summary. A successful installation summary looks like this:

Testing Your PHP Installation

So we got PHP installed, let's test it out to make sure it works!

Navigate to your WWW root folder ( default IIS folder is C:\inetpub\wwwroot ).

Create a new .PHP file named test.php.

Open your favorite text editor, and insert the code:

<?php
phpinfo();
?>

Next, navigate to http://127.0.0.1/test.php in your browser, you should see the PHP Info page. This page lists all the PHP modules installed and gives you a detailed overview of your PHP configuration.

Congratulations!

That's all there is to it!

There's a lot left to do depending on what application you wish to deploy on your server, but we've covered the basics of installing and configuring IIS 8 and PHP 5.x.

If you are looking to quickly deploy a popular web application, I encourage you check out the Applications tab in the Web Platform Toolkit, here you can easily deploy Wordpress/Joomla and other popular content management systems/blog engines.

Naturally, the next step in deploying dynamic content on the web usually involves some variety of a back-end database for storage. With WPI you can install SQL Server (express version is free if you don't own a lisence), or MySQL if you prefer to go that route.

Thanks for reading and if you have any questions, feel free to leave a comment below.

Comments 3 comments

gsmtracker profile image

gsmtracker 3 years ago

Why IIS? Don't you think Apache will do a better job?


Zack 3 years ago

detailed manual instructions would be nice. Big hole in this article. Not everyone wants to automate and forego having control of their installation.


Sanjay 2 years ago

How To Install PHP In Windows Server 2012..........http://mytecharticle.com/how-to-install-php-in-win...

    Sign in or sign up and post using a HubPages Network account.

    0 of 8192 characters used
    Post Comment

    No HTML is allowed in comments, but URLs will be hyperlinked. Comments are not for promoting your articles or other sites.


    Click to Rate This Article

    Menu

    Explore