Articles
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.
- Add new comment
- 736447 reads

Comments
First thing I would try if
First thing I would try if you haven't already done so is turning off the "Show friendly HTTP error messages" option in IE7. This can be found by going to tools > internet options > advanced.
As a general rule of thumb I would steer clear of using directory structure with spaces in them, especially when dealing with software whose origin is from a *nix background such as PHP. That said I am sure I have had working PHP environments with the installation dirs in Program Files before, so without looking at the system I'm not exactly sure. One thing you could try is to use the 8.3 format naming convention when setting the path to php5isapi.dll, so it would look like this;
C:\PROGRA~1\PHP\PHP5isapi.dll
This way you wouldn't need to use the "" to enclose the path.
----------------
Dominic Ryan
3 x Microsoft IIS MVP, MCSE, MCSA
IIS Aid owner/webmaster
problems
Good Day for all,
i´m install php 5.2.4, mysql community edition 5 on II6 and win 2003 server, and my problem is:
i´m test with phpinfo file and get next message:
"The system cannot find the path specified."
and i´m check enviroment paths, and everything is ok. could u give me some help?¡
The places you'll really
The places you'll really need to look at at your PHPRC and PATH environment variables, but as you've said you've check those I'd double check your PHP application mapping path in the IIS Admin control panel. For the moment I'd also advise you do disable all your PHP extensions in php.ini, just so we know PHP isn't looking for some other library related to your PHP extensions.
----------------
Dominic Ryan
3 x Microsoft IIS MVP, MCSE, MCSA
IIS Aid owner/webmaster
Getting error while creating chglist.vbs script
I have installed PHP on IIS. I had followed all steps upto creating chglist.vbs script. But at this step i am getting an error as
Windows Script Host
Script: D:......
Line:1
Char:1
Error: Invalid Character
Code:800A0408
Source:Microsoft VBScript compilation error
I found this script on David Wang's blog
Please suggest any remedy for the above error...
thnx in advance
Regards
Amar
If you downloaded the script
If you downloaded the script from my site and have not edited it at all then it should work. If you do edit it, make sure that you only edit it with something like notepad, as word processes such as Word will cause issues. For example the ' character which is the first character in the script will be saved as a ` if you save it at all from Word which is invalid.
----------------
Dominic Ryan
3 x Microsoft IIS MVP, MCSE, MCSA
IIS Aid owner/webmaster
got it working at last
i finaly got php to display the test page thanks to your guide
but i have a question for u.......
dos ;extension=php_mysql.dll and remove the semi colan (;) conect php to mysql coz im having a real problem with something called joomla thats not leting me connect it to the mysql database.
thanks in advance
hempy =)
That's great hempy, glad the
That's great hempy, glad the guide helped! You are correct, removing the semi colan from the front of ;extension=php_mysql.dll will load the MySQL extension to enable you to connect to a MySQL database. Be sure to restart IIS in order to make the changes effective.
----------------
Dominic Ryan
3 x Microsoft IIS MVP, MCSE, MCSA
IIS Aid owner/webmaster
same problem with blank page
I got the same problem displaying blank page without any error msg. I run the PHP as a CGI mode. my test page is
echo "php"; ?>
something
just the "something" display but no "php"
any reason?
thanks
First thing to do is to make
First thing to do is to make sure the display_errors directive in php.ini is turned on so that if there are any errors they are printed to your screen. Also, what do you mean exactly when you said you test page is "something"? You test page should contain something like this;
<?phpphpinfo();
?>
----------------
Dominic Ryan
3 x Microsoft IIS MVP, MCSE, MCSA
IIS Aid owner/webmaster
php code appear
I have the same problem:
When going to see my "phpinfo.php"
The only thin I see on my browser is the code of the file:
<?phpphpinfo();
?>
Thanks