Articles
Installing PHP 5 on IIS in 5 simple steps
Yes, yet another PHP 5 installation guide. Why write one when there are already dozens of them out there? Well there are two main reasons: firstly I will be writing a lot of guides that require PHP to be installed and working and I will need something to point people to who have yet to install PHP. Secondly, I have read a lot of the guides out there and found that a good portion of them over complicate the process. It really should not be that hard or perplexing. In this guide we'll break down the process of installing PHP 5 on IIS into 5 simple steps that are easy to follow that works for IIS 5, IIS 5.1 and IIS 6.
NOTE: This guide is intended for use with PHP 5.2.x and below. A guide for PHP 5.3 and above will be published in the coming weeks.
So what are these 5 simple steps? In a nutshell, this is all you need to do to install PHP 5 on IIS;
- Download and Extract PHP 5 (we'll install PHP 5.2.1 on IIS 5.1 in this guide)
- Set your environment variables
- Set the PHP application mapping in IIS
- Configure php.ini
- Restart & Verify
Just before we continue I thought it pertinent to mention that it if you have already installed, or attempted to install PHP on your system then you must remove all traces of that install before continuing. If ANY PHP files exist anywhere else on your system that are accessible via the PATH environment variable, then it is very possible (even probable if the previous version of PHP was different) that you will have issues with hosting PHP content.
If you are wanting to install PHP 4, then the process is slightly more complex than installing PHP 5 and involves steps not covered in this guide. Not to worry as it is even easier for you. All you have to do is download the IIS Aid PHP Installer from this site and run the fully automated GUI installer. This installer will completely setup your PHP 4 environment, including all environment variables, IIS scriptmaps and IIS 6 web extension. The particular advantage of this installer is that it configures PHP 4 to use FastCGI mode as well as an Opcode cache for maximum performance. Expect to see some articles of just how much faster here in the future.
1. Download and Extract PHP 5
Nothing taxing about this, simply go to the PHP download page and download the latest PHP zip package from under the "Windows Binaries" section, along with the latest PECL Win32 binaries (do not get the ones marked "non-thread-safe" unless you plan to use CGI/FastCGI as otherwise you run the risk of a race condition). Save the PHP zip package to the directory where you will want to install PHP (e.g. D:\PHP), and then extract. Once extracted you'll see inside your PHP installation directory a sub directory called "ext". Save the PECL Win32 binaries download into it (e.g D:\PHP\ext), and then extract. Your PHP install directory should now contain all the content of your PHP zip package file, and your ext sub directory should contain the contents of your PECL Win32 binaries file. From here move back to the root of you PHP installation directory (e.g. D:\PHP) and create three directories, one called sessions, one called upload and one called log. In the log directory create a new file called php.log. First step licked.
- Add new comment
- 737610 reads

Comments
Nice one Matt! Just for
Nice one Matt! Just for future reference you'll find that restarting your application pool (if using IIS 6/7) or restarting IIS will be enough to apply your changes in php.ini.
----------------
Dominic Ryan
4 x Microsoft IIS MVP, MCSE, MCSA
IIS Aid owner/webmaster
Thank You
EXCELENT !!
Very well written ,everything worked fine for me in the 1st try itself . . .Thanks to you
An exilent overhaul!!!
Thank you so very much.
At last - you - made it happen.
/Magnus
PECL Win32 binaries
I looked all over and I cannot find:
(1) Any idea of what PECL Win32 binaries are, and
(2) The to download.
I was able to download the Win32 binaries, but the cited web page has absolutely no mention of PECL Win32 binaries other than the fact that they are NOT included with the Win32 binaries!
How do I get the PECL Win32 binaries?
What are the PECL Win32 binaries?
rrr
Total Newbie - Didnt Work
I wasencouraged reading this tutorial. It took some time to find the PECL whatchamacallit, nbut I was able to perform all of the steps finally.
Then I restarted IIS, went into explorer, clicked on the phpinfo.php file, and got the "Windows does not recognize this extension" box.
I really know next to nothing about IIS and we4b servers in general, so I do not know where to go next to get PHP to work,.
Machine is Windows XP SP3 and IIS is 5.1
I downloaded the following from the PHP sites:
php-5.2.8-Win32.zip (extracted to C:\PHP)pecl-5.2.6-Win32.zip (extracted to C:\PHP\ext)
The Websites properties Home Directories/Configuration has the file extension of ".php" set for the dll: "C:\PHP\php5isapi.dll". Both checkboxes mentioned are checked.
Help!
rrr
No PECL release for 5.2.8, use PECL release for 5.2.6
Obviously you figured out that there is no PECL release for PHP 5.2.8, and that you should use the PECL release from PHP 5.2.6.
Sounds like you are very close with your PHP configuration. The one issue I can see that you are doing is that you are accessing your phpinfo.php file directly via windows explorer. By doing this you effectively bypass IIS, so the php script is never processed. Think of it like your php files only speaks Japanese, your Internet browser only speak English, and IIS is the interpreter.
Assuming you have placed your phpinfo.php file in the root of you IIS website, then what you need to do to have IIS process you php files is to open you internet browser and type in http://localhost/phpinfo.php into the address bar. This is also assuming that you are using an Internet browser on the computer that IIS and PHP are installed on.
----------------
Dominic Ryan
4 x Microsoft IIS MVP, MCSE, MCSA
IIS Aid owner/webmaster
Thank you!
Thank you, thank you, thank you.
This is the best, most concise, and well written guide for installing PHP on IIS....and it works!
PECL Win32 Binaries
http://snaps.php.net/win32/
Download "pecl5.1-win32-latest.zip"
Getting the Blank screen after php installation
Hi
I am installing php 5.2.8 on iis 5.1
after installation i am getting blank screen
what could be reason
give suggestions
Thanks,
Abhishek
I take it you are just
I take it you are just trying to do a phpinfo() ? If not, this should be the first thing to try after an install to verify that it is working. I'd recommend opening your php.ini and setting display_errors to on. This way any issues should be displayed in your web browser.
----------------
Dominic Ryan
4 x Microsoft IIS MVP, MCSE, MCSA
IIS Aid owner/webmaster