Installing PHP 5 on IIS in 5 simple steps


Configure PHP.ini

You could very easily write a series of articles regarding setting the various php.ini directives, so to try and keep this article short I will just deal with the basics here. When serving PHP on IIS the php.ini file is the only place that options are set, and if no php.ini file can be found then the defaults are loaded. The limitation of a single php configuration for an entire server is perhaps one of the biggest disadvantages with hosting PHP applications on IIS, especially in shared hosting environments.

There are actually only a handful of setting you will might want to look at configuring in php.ini, and they are the path to your extensions, sessions, and upload directories. You'll also may wish to enabled a few PHP extensions to get added functionality from PHP that might be required by some PHP apps, and perhaps set some PHP logging options.

  • Open your PHP installation directory (e.g D:\PHP) and copy php.ini-recommended and rename the copy to php.ini
  • Open php.ini and do a search for extension_dir = "./" and replace it with extension_dir = "D:\PHP\ext" where D:\PHP\ext is the path to your extensions directory (it's the one with all the files that begin with "php_" in it). The path to your PHP installation will be used for the next several steps, so take care that you modify them to suit your own environment.
  • Search for ;session.save_path = "/tmp" and replace it with session.save_path = "D:\PHP\sessions" (note the semi colon (;) is removed). This will be used to store PHP session information which is used by many PHP applications.
  • Search for ;upload_tmp_dir = and replace it with upload_tmp_dir = "D:\PHP\upload" (note the semi colon (;) is removed). This is used for all your HTTP upload files, and if not set your system temp will be used.
  • Search for ;error_log = filename and replace with error_log = "D:\PHP\log\php.log" (note the semi colon (;) is removed). This is where all your PHP logging information is kept when enabled. You can also configure PHP to log data to your Event Log, but it requires loosening the privileges on the IUSR_COMPUTERNAME account IIS uses.
  • Search for ;extension=php_mysql.dll and remove the semi colan (;) from infront of it so it appears as extension=php_mysql.dll. You'll almost certainly need this PHP extension loaded as any PHP application that uses the MySQL database will need it.


Anonymous's picture

Truely 5 Steps and very easy

Thanks for a superb article. Read a few articles on installing PHP on IIS but couldn't get it done. This one did the trick.

Anonymous's picture

Thanks a lot, its easy and

Thanks a lot, its easy and nice article
Only one extra thing i did i repeated first part of the 3rd step for my virtual directory as well.

Anonymous's picture


So, I've got everything working with PHP using this guide, and the site I made works great!

However, I was wanting to extend the site to add an email verification thing (you know, where you have to click some link emailed to you to verify you're a person), and I was using the 'mail' function PHP has.

This is the first time I've ever touched email from PHP, so this may have NOTHING to do with IIS (It's Windows 2000 Server, so using IIS 5.0) and entirely to do with my naivety, but I can't get email to work. Here is my code:

$mail = mail('', 'Hello, world!', 'This is a message from PHP. Neat, huh?');

if ($mail == TRUE) {
printp('Mail sent!');
} else {
printp('Mail fail.');

How would I get this to work? The email address there was edited, in my actual page it's using my own personal email address.

I have IIS's SMTP service installed, but I don't know how to configure that either. I've never touched email serving before, so this could really be just me being naive.

Anonymous's picture

You are a star

Mate, I don't know how many years ago have you posted this useful information. I was trying to learn PHP through a book, but their instructions to install PHP in IIS didn't work and I was stuck. This was just WONDERFUL information from you. Thank you very very very much.

Anonymous's picture

Is PHP5.3 much different when installing?

Excellent tutorial. I am getting an error in phpmyadmin -
Your PHP MySQL library version 5.0.51a differs from your MySQL server version 5.5.12. This may cause unpredictable behavior.

So I guess I need to upgrade PHP, or downgrade MySQL. Do you agree?
Is there any chance you will be posting instructions for installing PHP 5.3 on IIS? I tried following the same instructions but it doesn't work :(


Brashquido's picture

No ISAPI in PHP 5.3

You'd be correct with your guess. PHP 5.3 is a pretty big change from PHP 5.2, one of the most notable changes was the ISAPI interface (which is used in this guide) was dropped from the package. I will be creating an install guide, however it may be a month or two off yet.

Dominic Ryan
6 x Microsoft IIS MVP, MCSE, MCSA
IIS Aid owner/webmaster

Anonymous's picture

Excellent Doc - Thanks

It solved my problem on IIS5. Step by Step useful instructions.

Thanks a lot,

Anonymous's picture

Getting error: Execute Access Forbidden

I did everything as stated here, but i am getting following error. Kindly help.
HTTP 403.1 Forbidden: Execute Access Forbidden
Internet Information Services

Anonymous's picture

PHP installed by WAMP to be configured in IIS 5.1

Before i start following the tutorial, i would like to clarify whether I can follow these steps if I have the php instance installed in my system through WAMP.
I have the WAMP server running and my php directory resides in C:\wamp\bin\php\php5.3.5

Please guide me..
Thanks in Advance


Anonymous's picture

PHP5Isapi.dll is not available in PHP 5.4

i tried to do installation with this article, but unfortunate that the downloaded php 5.4 do not contain the php5isapi.dll file.
also the PECL Win32 binaries is not found on php download site.

how can i complete this installation! can anyone suggest?