How to setup IIS 8 and PHP on Windows Server 2012

Updated on October 27, 2016

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

    0 of 8192 characters used
    Post Comment

    • profile image

      Sanjay 

      4 years ago

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

    • profile image

      Zack 

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

    • gsmtracker profile image

      gsmtracker 

      4 years ago

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

    working

    This website uses cookies

    As a user in the EEA, your approval is needed on a few things. To provide a better website experience, turbofuture.com uses cookies (and other similar technologies) and may collect, process, and share personal data. Please choose which areas of our service you consent to our doing so.

    For more information on managing or withdrawing consents and how we handle data, visit our Privacy Policy at: https://turbofuture.com/privacy-policy#gdpr

    Show Details
    Necessary
    HubPages Device IDThis is used to identify particular browsers or devices when the access the service, and is used for security reasons.
    LoginThis is necessary to sign in to the HubPages Service.
    Google RecaptchaThis is used to prevent bots and spam. (Privacy Policy)
    AkismetThis is used to detect comment spam. (Privacy Policy)
    HubPages Google AnalyticsThis is used to provide data on traffic to our website, all personally identifyable data is anonymized. (Privacy Policy)
    HubPages Traffic PixelThis is used to collect data on traffic to articles and other pages on our site. Unless you are signed in to a HubPages account, all personally identifiable information is anonymized.
    Amazon Web ServicesThis is a cloud services platform that we used to host our service. (Privacy Policy)
    CloudflareThis is a cloud CDN service that we use to efficiently deliver files required for our service to operate such as javascript, cascading style sheets, images, and videos. (Privacy Policy)
    Google Hosted LibrariesJavascript software libraries such as jQuery are loaded at endpoints on the googleapis.com or gstatic.com domains, for performance and efficiency reasons. (Privacy Policy)
    Features
    Google Custom SearchThis is feature allows you to search the site. (Privacy Policy)
    Google MapsSome articles have Google Maps embedded in them. (Privacy Policy)
    Google ChartsThis is used to display charts and graphs on articles and the author center. (Privacy Policy)
    Google AdSense Host APIThis service allows you to sign up for or associate a Google AdSense account with HubPages, so that you can earn money from ads on your articles. No data is shared unless you engage with this feature. (Privacy Policy)
    Google YouTubeSome articles have YouTube videos embedded in them. (Privacy Policy)
    VimeoSome articles have Vimeo videos embedded in them. (Privacy Policy)
    PaypalThis is used for a registered author who enrolls in the HubPages Earnings program and requests to be paid via PayPal. No data is shared with Paypal unless you engage with this feature. (Privacy Policy)
    Facebook LoginYou can use this to streamline signing up for, or signing in to your Hubpages account. No data is shared with Facebook unless you engage with this feature. (Privacy Policy)
    MavenThis supports the Maven widget and search functionality. (Privacy Policy)
    Marketing
    Google AdSenseThis is an ad network. (Privacy Policy)
    Google DoubleClickGoogle provides ad serving technology and runs an ad network. (Privacy Policy)
    Index ExchangeThis is an ad network. (Privacy Policy)
    SovrnThis is an ad network. (Privacy Policy)
    Facebook AdsThis is an ad network. (Privacy Policy)
    Amazon Unified Ad MarketplaceThis is an ad network. (Privacy Policy)
    AppNexusThis is an ad network. (Privacy Policy)
    OpenxThis is an ad network. (Privacy Policy)
    Rubicon ProjectThis is an ad network. (Privacy Policy)
    TripleLiftThis is an ad network. (Privacy Policy)
    Say MediaWe partner with Say Media to deliver ad campaigns on our sites. (Privacy Policy)
    Remarketing PixelsWe may use remarketing pixels from advertising networks such as Google AdWords, Bing Ads, and Facebook in order to advertise the HubPages Service to people that have visited our sites.
    Conversion Tracking PixelsWe may use conversion tracking pixels from advertising networks such as Google AdWords, Bing Ads, and Facebook in order to identify when an advertisement has successfully resulted in the desired action, such as signing up for the HubPages Service or publishing an article on the HubPages Service.
    Statistics
    Author Google AnalyticsThis is used to provide traffic data and reports to the authors of articles on the HubPages Service. (Privacy Policy)
    ComscoreComScore is a media measurement and analytics company providing marketing data and analytics to enterprises, media and advertising agencies, and publishers. Non-consent will result in ComScore only processing obfuscated personal data. (Privacy Policy)
    Amazon Tracking PixelSome articles display amazon products as part of the Amazon Affiliate program, this pixel provides traffic statistics for those products (Privacy Policy)