|Install PHP on Server 2008 R2|
In most cases, installing PHP on a Windows Server is a pretty routine task. Server 2008 R2 offers a new issue which wasn’t present in previous versions of Windows Server. As you may know, Server 2008 R2 is 64 bit ONLY. There is no 32 bit version. On top of this, IIS7’s interface is entirely different than IIS6, making this a much un-routine like task. Well I started building up a new web server and needed to install PHP and encountered this exact scenario. Here’s my help for everyone else encountering this same task.
First, one thing should be noted. There are several different ports for a 64 bit PHP installation, none of which are official releases and can be somewhat unstable. I will explain to you how to run 32 bit php dll’s on Windows Server 2008 R2 x64
This article will explain how to install PHP using the bare minimum settings. Additional settings, modules, clicks may be necessary to get your installation working.
Install the Web Server
Open Server Manager –> Roles -> Choose Add Roles –> Select “Web Server (IIS)”
On the Select Role Services screen, the only additional thing we need is ISAPI Extensions
Click next through to the end and let it finish the install. Your server may ask you to restart. If it does, do it. If not, proceed the the next step
Open your web browser and go to http://www.php.net/downloads.php
Download the latest Windows Binaries zip package.
Once downloaded, open the zip file and extract the contents to C:\PHP
Open IIS 7 Server Manager –> Double click on “Handler Mapping” -> Select “Add Script Map…”
For Request path enter: *.php
For Executable enter: C:\php\php5isapi.dll
For Name enter: PHP
Your window should now look like this:
A dialog like this will show up:
Go back to the main IIS Manager screen
Click on ISAPI and CGI restrictions –> Click “Edit Feature Settings…” –> Select “Allow unspecified ISAPI modules”
Configure Application Pool
Next we need to create an Application Pool for your PHP Application
On the main IIS Manager screen, click Application Pools –> “Add Application Pool…”
Give your Application Pool a meaningful name
Under .NET framework version select “No Managed Code”
You can leave the rest default.
Right click on your new Application Pool and select “Advanced Settings…”
Set “Enable 32-Bit Applications” to True
I found that I had to restart my server after this portion, this may or may not be necessary for you.
Assign Application Pool to your Web Site
Right click on your web site and select Manage Website –> Advanced Settings.
Under Application Pool, select your newly created application pool
Test your PHP installation
Create a file called phpinfo.php in the root of your application with the following text
----------COPY EVERYTHING BELOW THIS LINE----------
----------COPY EVERYTHING ABOVE THIS LINE----------
If everything turns out, you should get your standard phpinfo output.
Now erase that file because it contains far to much information which you don’t want to leave out there.