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.
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.
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.
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:
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.
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.
This article is accurate and true to the best of the author’s knowledge. Content is for informational or entertainment purposes only and does not substitute for personal counsel or professional advice in business, financial, legal, or technical matters.