PHP5 with IIS6 on Windows Server 2003 in five easy steps

[Update: Follow this link if you are looking for an updated tutorial on PHP5 with IIS7 on Windows Server 2008]

How to install and configure PHP5 with IIS6 on Windows Server 2003 in five easy steps.

I thought installing PHP would be as easy as just using the install program. Well it wasn’t… But by learning from my mistakes it can be almost that easy.

Just follow these five easy steps on how to install and configure PHP 5 on a Windows Server 2003 running IIS – after trying the manual and several guides and tutorials found on the net (of which some were very long and very complicated and some were short and easy but partially incorrect) this is what it all came down to. Enjoy.

This is tested on PHP 5.0.4, IIS6 on Windows Server 2003 SP1. Be aware that IIS is not automatically installed with all editions of Windows Server 2003, this guide assumes that IIS 6 and Windows Server 2003 is already up and running on your server.

1. Download PHP at http://www.php.net/downloads.php. Make sure you dowload the “zip package”, the installer package won’t work.

2. Extract the downloaded zip file to a directory of choice on your harddrive. The rest of this guide will assume you are using C:\PHP

3. Add C:\PHP to your path. From the Start menu, right click My Computer and select Properties. From the Advanced tab click the Environment Variables button. Under System Variable find Path and click Edit. At the end of what is already present in Variable Value add a semicolon (;) and then C:\PHP.

4. Configure IIS. Open the Internet Information Services (IIS) Manager from Administrative Tools (found directly in the Start menu or in the Control Panel)

a) Web Service Extension. Click down to the Web Service Extension folder. Right click the folder and select Add New Web Service Extension. Set Extension Name to .PHP and add C:\PHP\PHP5ISAPI.DLL to Required Files . Check Set Extension Status To Allowed.

b) Web Sites. Click down to Web Sites. Right click the folder and select Properties. From the Home Directory tab click the Configuration button. Click Add to add an Application Extension. Enter C:\PHP\PHP5ISAPI.DLL as Executable and PHP as Extension. Leave the rest as default and click Ok.

5. All set! To test your PHP installation simply create text a file with the php extension, eg. test.php. Add the following three lines of text to it and then save it to your web site directory, eg. C:\INETPUB\WWWROOT. Then use your browser to read the file, eg. http://localhost/test.php

<?php
phpinfo();
?>

Other things you might want to consider:

– Some tutorials state that you need to restart the World Wide Web Publishing Service after having installed and configured php. I haven’t needed to (ie everything worked fine without restarting the service) but if you do it is found under Services in the Control Panel.

– As you start using PHP, in the not too distant future you will probably need to make some changes to php.ini. PHP works fine without the php.ini file but you really should have one and it should be in your Windows directory. Copy C:\PHP\PHP.INI-RECOMMENDED to C:\WINDOWS\PHP.INI

– If you are going to use MySQL you will need to make sure to uncomment the line “extension=php_mysql.dll” in php.ini and copy C:\PHP\LIBMYSQL.DLL to C:\WINDOWS\SYSTEM32 (Simply setting the PATH won’t work as this is apparently hard coded in PHP5). If you don’t follow these steps you will get an error message similar to this: “Call to undefined function mysql_connect”

– Read the manual at http://www.php.net/manual/en/install.windows.php

[Updated: If you have any problems, make sure you read the comments to this post. You will find both tips and questions there. If you know the answer to someone’s question please answer it.]

(This article is previously published and has been moved to this blog)

231 Replies to “PHP5 with IIS6 on Windows Server 2003 in five easy steps”

  1. Thanks!
    Your instructions were really easy to follow and I’m now ready to learn PHP – Sue, Sydney

  2. Man you did a great job! I had an exam
    project for school, and I made an webshop in .asp so I could not use XAMMP as a webserver we normaly use that for our websites. But the webserver also needed php support, So I started searching on google and found this blog, it works excelent! double thanks!!

    greetings from holland =)

  3. ummm.. i just want to point out a FLAW in your tutorial…
    You forgot to let the users know to un-zip the PHP zip file, in-order to find the “php5isapi.dll” file!!!

    haha j/k about the flaw, its not your fault i’m a retard!!!

    Thank you so very much for taking the time to type up the tutorial, i tried numerous other tutorials on-line with no luck, yours is truly the simplest and best….
    thank you again

  4. Damn….. Your guide looked really cool and I tried to use it for installing PHP on my IIS 6.0 but all I get is a page cannot be found when I try to access my test.php file

  5. Thanks all for your kind and positive feedback!

    Re the “page cannot be found” error. From your problem description it’s difficult to say why you get this but to me it does not sound like it has to be a problem with the PHP installation but rather that you put the test.php file somewhere else than where you try to access it, e.g. you put it in c:\inetpub\wwwroot\phptest\test.php but try to access it using http://localhost/test.php instead of http://localhost/phptest/test.php

    It could also be rights related, check the rights on the file and directory (simply right-click and select Properties on the file and/or directory from Explorer in Windows). Good luck.

  6. “Make sure you dowload the “zip package”, the installer package won’t work.”

    Perhaps it would be clearer if it said:
    Make sure you download the “zip package” and not the installer package. These instructions are for the zip package. (And besides, the installer package is somewhat limited.)

  7. Hmmm.
    Using PHP 5.1.4 and MySQL 5.0 on WinServer 2003 SP1 and IIS6.

    Have 2 libmysql.dll files.

    One is in the php folder (1.01 MB (1,069,056 bytes); May-4-2006).

    The other is in the mySQL bin folder (1.40 MB (1,470,464 bytes); Apr-27-2006)

    So…now what?
    Does this file **need** to be in the Windows folder?
    Which version is preferred?

    p.s., running mediawiki (wikipedia software) on this framework and everything seems to be working just fine. And my php test file runs as well.

  8. Replies to two last comments: (everybody is using Anonymous to comment so I’m sorry I can’t refer to you by name)

    The reason I wrote “install package won’t work” is because it did not work when I tried it. Calling something that does not work “limited” is for politicans and software giants 😉
    Maybe they’ve fixed it and it does work now, I wouldn’t know because I haven’t tried installing PHP since I wrote these instructions. If anybody knows, please comment.

    Short answer to the question about libmysql.dll – Sorry, I don’t know.
    My guess however is that the dll being used is the one in your PHP package and since that is the latest (according to the date stamp) I would think that is a good thing.

  9. Great instructions!

    But I’m having a problem installing PHP 5.1.4, MySQL 5.0, and mediawiki on WinServer 2003 SP1 and IIS6. I installed PHP using your instructions and the test works great. (I copied libmysql.dll to windows/system32.)

    However, I get the message “You are not authorized to view this page” when I url to my mediawiki.

    The mediawiki install instructions say to set the PHP extension to php-cgi.exe instead of php5isapi.dll.

    Any ideas on what to use or how I can make this work? I know my question is way beyond PHP, but I’m a novice on PHP, MYSQL, and wikis and lost.

  10. Thank you so much. After a couple of failed attempts (well, duh, if they had succeeded…) I found these instructions and they worked perfectly. No reboot or restart of IIS required on my machine.

  11. THANKS,, this is the easier so far I can found on google..how to install php on iis 6,

    Thank again…keep up good tips/howto..

  12. Thanks for the help!
    I was getting 404 errors, then removed everything and followed your steps (I had done them all already), but I had also configured a php.ini – I think something was not right in the file. Now my pages are working fine.

  13. So Cool! – These instructions worked perfectly. Up and running in zero time. thanks for the great effort
    Steelryno – Dundalk, MD

  14. Hi,

    I’m getting 404 error…

    i tried the steps couple of times.. but still gettting this error.

    Pls help me.

    I’m using W2k3 Server, IIS6, PHP 5.1.4

    Kiri

  15. You sir, are a legend, Thankyou, I have been banging my head trying to get this to work for ages.

  16. It was very useful. Thank you! I also had another problem. I put in console to check all loaded modules:
    >php -h

    So it returned some errors “can’t load mysql module” and “Missing MSVCR71.dll”. When I downloaded and installed MSVCR71.dll all errors gone amd modules start loading perfectly. Check if MSVCR71.dll located in your “C:\WINDOWS\system” directory.

  17. i have the problem. the time execution was time out….
    i;m using windows XP, with IIS 5.1 and PHP version 5.1.4
    please help..

  18. Excellent tutorial indeed. Very good work and everything is very clear and good explained.

    Thanks for your time and effor to help others out.

  19. To Canada,

    no — you should get a lot (about two pages full) of text of information about PHP.

    I’m new to this, but for the guys getting server not found errors, get into IE and turn off those “friendly error” messages. You sohuld get the ugly 403.1 etc messages.

    I got a 403.1 about executing scripts — make sure you go to the Home Directory tab in IIS website properties and set Execute permissions to Scripts and Executables.

  20. Thanks for the HowTo. It was well written and informative. I had issues after following these steps because I had previously taken the lazy way out and this auto-installer. This had a different ISAPI extension configured. I changed the path of the executable to C:\PHP\PHP5ISAPI.DLL while following your instructions, but an IIS restart (old habit from my Apache days) changed it back to c:\PHP\php.exe. I made the change again and all is well.

    Thanks!!
    Juice

  21. Excellent article chap, had been baning my head on this issue for a few hours, this article was very helpful for me to regain focus.

    Cheers!

  22. Sir I thank you as much as the others

    However for the sake of completeness and accuracy, and remembering that un-sophisticated users like myself are turning to you in desperation could you amend step 4b to make clear that the extension entered is “.PHP” and not “PHP”, otherwise the OK button remains greyed-out

  23. That was awesome I was working on this all day and after reading your explanation it took all of 5 minutes. Thanks!!

  24. THANK YOU! I spent hours trying to get this to work before finding your instructions. In less than 10 minutes my site is working perfectly!

  25. New to PHP, using Windows XP Pro, Mysql, Apache 2.2, and PHP.

    I was getting a 403 “Not Authorized” error. Was reading this blog, read the note above about changing the “friendly error messages” flag. Un-selected the flag, now test.php is trying to be downloaded.

    Any help is much appriciated!!

  26. Excellent, clear step by step Instructions, really helpful. up and running within 10 mins. Thanks Buddy!!

  27. I’ve tried everything in this post and everywhere else I can find, however I still can’t get mySQL to load. PHP works fine, phpinfo() returns correct information, mysQL.dll and libmysql.dll are in the right locations, yet I get an error “cannot load mysql extension”. Please help!

    I’m using PHP5 from the zip file, IIS6, W2003.

  28. “On 64-bit Windows, the World Wide Web Publishing service does not support running 32-bit and 64-bit worker processes concurrently on the same server.”

    oops. don’t try php on your x64 server if you also need to run asp.net apps (or any other x64 based app!). ugh.

  29. Following your directions to the T (which were super easy thank you!), when i run my http://localhost/test.php

    It’s like it’s not detecting my c:\windows\php.ini !!! Arrg this is so aggrevating.

    I’ve restart the PC, I’ve restarted World Wide Web Publishing Service and nothing!

    I’m running:
    win2k3 w/ sp1, iis6, PHP 5.1.4

    any ideas?!

    thanks,
    rudy

    PS: how do i “know” that it’s not detecting my php.ini?

    Well i turn “display_startup_errors = On”

    and when I restarted the PC and then restarted WWWPS, my test.php page shows the “display_startup_errors” as being off!

  30. I too had problems with pages not showing up. If I set the web site to a directory below the wwwroot folder or any other folder on the (dedicated) server, I would get an error. It wasn’t until I had a phpinfo page in wwwroot and accessed it directly that I realized that IIS was confusing the directories.

    I opened php.ini and found that the root dir was set to wwwroot. I commented this out (because I will be running several web sites on the server), and it worked.

  31. Thank you very very much!!!
    I’ve been spending weeks trying different instructions but failed to work.
    You are really great!
    Your children will be pround of what you did.
    Just to highlight one minor but enough to make me panic mistake. Please remember to right click on your web site and select the “start” option.
    so happy! Yeh! yeh! yeh!

    Once again

  32. I followed your instructions and this is my resulting predicament. Wondering if you can help…

    I have all of our sites in a inetpub directory on the D drive, so the test.php file is located at D:\inetpub\domainx.com\www\test.php (the root of the site being www). The default web site for this machine is still pointed to C:\inetpub\wwwroot. Now, when I try to bring up http://www.domainx.com/test.php I get page cannot be found. I tried http://localhost/test.php and that worked, even though the file is not located in the root of localhost (default site), it is in the root of domainx.com. Weird. PHP is basically working only on the default web site and directory but getting files from the intended location (domainx.com root)? I am not sure what is going on and very much would appreciate any help.

  33. If you are getting “The page cannot be found” error you might to verify the the .PHP extention is beign handled properly. You can do this by following these instructions:

    Click the Home Directory tab, and click the Configuration… button. On the Mappings tab, find the PHP extention. If it is not there you can add it by clicking the Add button. Choose your php5isapi.dll file as the executable (note that the file type filter in the dialog is set to show .exe files only by default) and type .php in the extension box (including the .). Leave everything else unchanged and click OK.

  34. Is it possible to have support for both .php and .asp files simultaneously on the same iis? Are there extra configurations needed?

  35. Nice one! A Simple task made simple! – It might be worth adding as I found that on Windows Server 2003 SP1 IIS6, I had to give the IUSR account read permissions on the PHP folder so that the web user could run the PHP5ISAPI.DLL – All works great!

  36. Very good post. All worked well except that when I tried to access the PHP document from a web browser I get the Authentication window. I added prividges to the php directory, executible and dll. Anyone else having this problem on Windows SBS 2003?
    Dan

  37. brilliant brilliant brilliant !! however, I got an error that said something about CGI misbehaving – I changed the PHP extention under CONFIGURATION in IIS to the ISAPIDLL and it all works fine now. you are a god !!

  38. I used your not-as-succinct installer from a few months ago and was so very happy when it worked, and that this condensed version works as well is to say the least very pleasing. Well done, keep up the good work.

  39. A few of you were being prompted for a userid and pw for the PHP pages. I had the same problem and have a solution.

    I was working on a Win2k server with “Integrated Windows Authentication” turned on for my PHP application in IIS. I gave IUSR “read”, “execute” and “List folder contents” permissions on the PHP installation directory. Anyway, it all worked fine for Win2k workstations. Users who were accessing the PHP application with WinXP clients were prompted for a userid and password. To fix this, I had to give “read”, “execute” and “List folder contents” permissions to the “Authenticated Users” group on the PHP installation directory.

    I hope this helps.

  40. ERES UN PUTO GENIO!!! JAJAJA!!!
    Muchísimas gracias, llevaba tiempo intentándolo con el instalador e incluso a mano y no era capaz. Gracias de nuevo desde España!!!

  41. Thank you very much. I can’t believe how long the install.txt file is and how short and clear it could possibly be!

  42. These are the cliff notes for sure! very nice.

    I was able to get this to work on Windows 2k sp4, with IIS 5.

    However, I don’t see the the web service extension folder or how to configure that. It might be that I simply have no web service extensions like Front page configured.

    Anyways.. Many thanks!

    jc in miami
    jc_pineiro[at]yahooooo[dot]cooooom

  43. Hmmm….
    After having a successful installation based upon your directions, I had reason to stop then restart the web services. Since then, I have not been able to get the PHP test page to run!!

    I rebooted the server, still the same problem: “The Page cannot be displayed”.

    Any ideas?

    Please email swhitney [at] whitcom.com.

    Thank you.

  44. Nice post. I’d like to make a couple of suggestions.

    1) As an amendment to your step 3: Create a new System Variable called PHPRC and give it a value of “C:\PHP\”

    This will allow you to create your php.ini directly in C:\PHP\ and avoid having to deal with cluttering up the C:\WINDOWS\ directory.

    2) You can also put any needed DLLs (like LIBMYSQL.DLL) inside the C:\PHP\ directory (as opposed to putting them in C:\WINDOWS\SYSTEM32). To enable this functionality you simply need to modify one line in your php.ini: “extension_dir = “C:\PHP\”

    This just helps keeps things more clean IMO. Also makes life easier on permissions. This way you can set permissions once on the php folder and be done with it!

  45. Hi

    Great tutorial.

    One comment I would like to add though.

    I was having a lot of problems and kept getting the following error message when trying to open test.php

    ==================================
    You are not authorized to view this page
    You do not have permission to view this directory or page due to the access control list (ACL) that is configured for this resource on the Web server.

    HTTP Error 401.3 – Unauthorized: Access is denied due to an ACL set on the requested resource.
    Internet Information Services (IIS)
    ==================================

    I had sort of given up on getting the ISAPI to work untill I read that you had to give the IUSR_(systemname) read rights to the PHP folder.
    Well, that didn’t work
    Untill I went in to the advanced section of the security rights for the folder and told the system replace permission entries on all child objects.

    This made the whole issue disapear. Maybe you should add this as a sidenote to your tutorial. 🙂

    Thanks anyway!!!

    GreetZzZz

  46. Thank you for all feedback, tips and questions! I just updated the post to make sure people don’t forget to check the comments which seems to include great solutions to some common problems.

    Just to let you know why I don’t try to answer many questions here – I simply don’t know the answers to them. I no longer use php. I wrote this guide when I (with some difficulty) installed php a couple of years ago. I then did two projects in php but haven’t really touched it much since then, except for some maintenance.

    It’s not that I don’t like php but currenlty I’m doing most of my projects in asp.net/vb.net and I guess I just find it easier to focus on one development tool.

  47. i have windows server 2003 + iis 6 but its on an itanium 64 bit server. how do i rup php. any help would be greatly appreaciated.
    ~pushkarg2007@email.iimcal.ac.in

  48. I am using WinXP and IIS5 and want install PHP5.1. I cannot click on OKAY in the Mapping-tab of “Application Configuration” in IIS, it is greyed-out. I want to choose “C:\PHP\php-cgi.exe” and extension “php”.

  49. I used your instrutct to load up on Windows Media Editon as well. Everything was pertinent except for the web services. Thanks for saving me the time of printing and reading the install instructs!
    -nintender

  50. Thank you so much! There was much head-scratching going on here until I read your tutorial. Web Service Extensions did the trick!

  51. After install php 5.1 + and mysql 5.0+ the server is auto shutdown in an hour… I’m usng windows server 2003 with MS-SQL 2000. I don’t know if there a conflict as startup service. Anyone have this issue before? Thanks

  52. This is an excellent guide!

    Just a hint to other PHP newbies like me: If you get a Service Unavailable (503.x) error when attempting to load up your PHP page, make absolutely sure that the PHP directory is in the Windows PATH environment variable and that you have rebooted your server for that change to take effect.

    Cheers,
    Max.

  53. Extremely easy directions to follow…it took longer to FIND these simple instructions than it did to implement them…If only all tutorials were this easy ! Thanks !

  54. My whole server f**ked up after using this tutorial, nothing worked, I got an 404 error, then after changing it to set Execute permissions to Scripts and Executables to work I got a 403/403.2 error pages.

    This tutorial is sh*t!!

  55. This tutorial worked like a charm, now I have to install MYSQL. Thanks for the help, the PHP instructions left out a few steps.

    -Darren
    San Francisco

  56. im actually in starter state…
    kindly help me..
    i’ve installed my php…
    now i have saved a file with .php containing html tags enclosed to my php tag…
    im not able to view the content of my page… im only viewing a blank page… if i remove the html tags im seeing the the php code in web page… kindly say me about my problem and try to rectify it…..

  57. thank you so much!

    just a little comments here:

    the sequence of your steps are so important! I set up a few machines successfully, but yesterday I lost on one machine, later on I found I set step 4.b first and then step 4.a, it is strange but maybe useful to someone like me.

  58. Dear sir,
    I’m Lusi, comp science student of univ of indonesia. Currently, I’m doing internship and develop web-based apps using PHP 5.0.5, IIS 5.1, and MSSQL Server.

    My system could run smoothly on my PC and my notebook. But when I try to deploy in this company’s production server, my system could’t running perfectly. This company also use PHP 5.0.5, MSSQL Server, but they use Win Sever 2003 and IIS 6.

    There are some features that didn’ work, that is feature that using session. I could not do “Login”, etc. Is it caused by different IIS settings or do you have any idea? There are some notice like Undefined index and Undefined offset. Please help me. The administrator there also have no idea.

  59. I want just to precise anything. This tutorial works in WIN2K3 but not in WIN2K3SP1. If any body can validate this point. i’ve made the test and i don’t understand why it’s not working. I’m besame really silly.

  60. To anonymous in last two comments:

    Hi,

    as stated in the post this is tested on win 2003 sp1, so at least I got it working when I wrote the tutorial.

  61. Excellent guide. I was about to give up after using other guides on the net but this did the trick. I did encounter the 401.3 error upon trying to view test.php initially but that was resolved by giving read access with inheritable permissions for the IUSER_MACHINENAME for the C:\PHP dir. Thanks!!!

  62. Don’t forget to change the Properties of your web sites to allow scripts to run – use IIS > website you want to enable PHP on > Properites > Home Dir > Execute Permissions = scripts only

  63. This is a very nice tutorial, useful for those new to system administration on Windows.

    I did see that a few people had asked how to get PHP to work on x64 architectures, even some comments that it wasn’t possible. I’ve been going around working on that myself, though you might want to consider adding these to your post for x64 architectures…

    – It is possible to run PHP on an x64 system, however you will have to update your x64 .NET Framework 2.0 install after doing the following
    – Open up a cmd.exe window, and navigate to your Inetpub\Adminscripts directory
    – Type in the following line:

    adsutil.vbs SET W3SVC/AppPools/Enable32bitAppOnWin64 1

    – That will tell IIS to run in x86 compatibility mode, again making your ASP.NET ISAPI filter temporarily unable to start. Just run your updates for the .NET Framework 2.0, and it’ll throw a 32-bit version in there instead

    Also, I had a rather advanced question for you that’s been bothering me for -quite- some time. With IIS 6.0 on Windows Server 2003 R2 and MySQL 5.0.x, I have yet to be able to get PHP to connect to a MySQL database. I always receive a “Can’t create TCP/IP socket” error. Have tried adding PATH variables, moving mysql libraries around, enabling named-piping in MySQL, but all to no avail. I’m actually getting rather desperate, so if you’ve got a few spare moments and care to help me out, please let me know by emailing me at amale@zibings.com. Thanks in advance, and I hope the x64 additions can help someone.

  64. Thanks for taking the time to post your experience. Unfortunately, this method did not work for me. I even tried copying the php5sapi.dll into the system32 folder.

    Perhaps this comment could help others. I used the php-5.2.0-win32-installer.msi and it worked perfectly. But, one must add Filter Name “php” and Executable “C:\PHP\php5isapi.dll” under IIS Manager -> Web Sites -> Properties -> ISAPI Filters.

    Additionally, I like to run my PHP scripts using a different extension (just to keep’em guessing). You can do this by adding the extenison you want to use (example: “.jon”) under IIS Manager -> Web Sites -> Properties -> Home Directory -> Configuration -> Mappings -> Application extensions. Just enter the extension and point it to “C:\PHP\php5isapi.dll” (assuming you installed PHP under C:\PHP\). If it tries to tell you that the executable is already in use by .php, just close the window and it will take.

    I hope this helps someone.

  65. If someone get the error “cannot load mysql extension” on Apache/IIS at Windows, you just need to copy the “libmysql.dll” into your system32 dir (e.g. “C:\windows\system2”). 🙂

  66. :(I got a 403.1 about executing scripts
    i did something and the page worked but the page was blank. can you help me I have been banging my head trying to get this to work for ages:(

  67. I need some help with my Windows Server 2003. I just recently installed SP1, and after the automatic reboot, it goes to the screen with the moving bars, but never gets me to my login. Then it restarts over and over. Is there a way to uninstall it and get my previous setting back? Plus there was no System Restore installed. My e-mail is erics8463@yahoo.com.

  68. I need some help with my Windows Server 2003. I just recently installed SP1, and after the automatic reboot, it goes to the screen with the moving bars, but never gets me to my login. Then it restarts over and over. Is there a way to uninstall it and get my previous setting back? Plus there was no System Restore installed. My e-mail is erics8463@yahoo.com.

  69. Step 4 a Web Service Extension

    Now where is this web service extension?

    I am using IIS 5.1 on Windows Xp Professional

  70. You’re a life-saver! I was struggling with a MediaWiki (PHP & MySQL-based) installation on IIS6. The wiki setup wouldn’t hook up to MySQL. Finally, saw your note about adding libmysql.dll to the C:\Windows dir, did it & it worked!!!!!! Thank you!!!!

  71. great work man.
    you have nade life for many real easier.
    regards
    Noman
    (www.makePakistanBetter.com)

  72. Kaaa-ching! You did it man! I had an older Windows 2000 server where I installed PHP 5.2.1 (installer-package) on, everything worked great, but then a few days later we rebooted the server… PHP was dead…
    I then moved to a Windows 2003 server, thinking the IIS on the old one was out of shape, but same thing happened there – worked fine, then restarted server and no PHP…
    Then I found this great tutorial of yours, I uninstalled PHP and followed your instructions… At first it didn’t work, I received “500 Internal Server Error” messages when running my PHP script, and so I started looking into that. First thing I did was restart IIS. Same error. Then I built a phpinfo() file in the wwwroot, and that ran just fine! After that I checked back on my script again, and NOW it’s working like a charm! Really hope it holds true after the next restart too.. 🙂

  73. i do hope that instructions like these contain screenshots to help slow learners like me…

  74. I am getting a HTTP Error 401.5 – Unauthorized: Authorization failed by an ISAPI/CGI application.
    Internet Information Services (IIS)

    error with a password prompt, I’ve tried all rights changes listed above and to no avail will it work.

    iis runs regular html pages and php pages if I enter the password of my Admin user..

  75. Thanks a lot for your tutorial. I’ve spent the last few days looking for one that actually works correctly.

    Looks like you saved me having having to tear my hair out.

    Keep up the great work!

  76. For Windows, this work-around worked for me:

    Make sure you’ve copied the C:\Program Files\MySQL\MySQL Server 5.0\bin\libmySQL.dll to C:\windows\system32\

    DO NOT the C:\PHP\libmysql.dll to C:\windows\system32\

  77. Thanks for the manual, but from some reason, when i’m trying to open a test PHP file i receive a “Service Unavailable” error. Any ideas why? Thanks again.

  78. Thank you! Thank you! Thank you! You saved me so much time and headache by posting this!

    Zapped.Info

  79. Tack, tack, tack… you really helped out a struggling me trying to get things around.

    halsningar fran Istanbul

  80. UPDATE:
    for everyone having PAGE NOT FOUND/404 errors, you need to perform the following steps:
    in IIS manager, right click on the web site itself (not the folder as stated), choose properties, home directory tab, configuration, and add the php extension there. That should clear up the problem. If not, also add PHP (php5isapi.dll) to the ISAPI filter tab in properties.

  81. thanks,

    Tried this before and gave up with the idea of using php in a 2003 enviroment. Your instructions were very helpful

    Adrian, Limerick, Ireland

  82. Many thanks – note that when using Windows 2003 SP2, the previously noted step below had to be issued before I could load a PHP page:

    Click the Home Directory tab, and click the Configuration… button. On the Mappings tab, find the PHP extention. If it is not there you can add it by clicking the Add button. Choose your php5isapi.dll file as the executable (note that the file type filter in the dialog is set to show .exe files only by default) and type .php in the extension box (including the .). Leave everything else unchanged and click OK

  83. This is right on for SBS 2003 as well. I spent a good part of the day jerking around with the 404 and 500 errors.

    Must follow this extra step, though:

    Click the Home Directory tab, and click the Configuration… button. On the Mappings tab, find the PHP extention. If it is not there you can add it by clicking the Add button. Choose your php5isapi.dll file as the executable (note that the file type filter in the dialog is set to show .exe files only by default) and type .php in the extension box (including the .). Leave everything else unchanged and click OK

  84. The msi installer didn’t work for me as of 8/15/07. I followed these instructions and I am running. Thanks! Brian L

  85. Nice tutorials thanks for your efforts. I stil have aproblem however, when I try to run the php page I get the authoriazation window to connect to my server!! Any idea why is this so ? I tred everything and it’ s not working for me 🙁
    thanks in advance for your help

  86. Thanks a lot!!
    I think you great,man.I just successfuly installed php-5.2.3 on my windows server 2003 64 literally following your 5 steps and , thank you ,I didn’t sweat.
    I’m going to install MySql now,hopefully will work with SQL server 2000 already on my computer.
    Cheers
    Joe
    West Australia

  87. Hey everyone,

    I am posting this because I spent way too long fixing this issue when it should not have been an issue.

    I installed PHP on IIS 6.0 and used all default settings. Well the extension mappings for each site had the path D:\PROGRA~1\PHP\PHP5IS~1.DLL as default to the filter. I kept getting 404 errors and couldnt figure it out. It turns out that IIS does not resolve the path D:\PROGRA~1\PHP\PHP5IS~1.DLL so I have to manually browse the file to get “D:\Program Files\PHP\php5isapi.dll” (The quotes are needed if the path has a space).

    This drove me nuts and hopefully solves a lot of peoples problems

  88. Brilliant !
    noone esle on the web mentions about location of php_mysql.dll being hardcoded,well done you, solved my issues

  89. I would like to thank you for making very light work in the installation of PHP on my dual xeon server at MaximumASP.com. Having many DOTNET applications on there, I was quite concerned that if I pooched the installation up, I would take down existing sites. Not only did this tutorial of yours make it easy, I am now able to take advantage of the well written flash galleries done in PHP as well as maybe learn a new language.

    Cheers from Canada
    eh 😉

  90. For the 404 problem. After following this blog’s instructions:

    IIS > webservice extensions > All unknown ISAPI extensions [change it to ALLOWED]

    It also works if you use the windows install package.

  91. Thanks man !, i’ve been sufering trying to install php 5 and Windows 2003 SP2and you made it quick and right.

  92. You Rock.

    Thanks so much for the helpful suggestions.

    I was getting a 404 error: file not found.

    In this case it was a .php file that it was not accepting from the wwwroot directory.

    I “allowed” the “All Unknown ISAPI Extensions” and it worked, but if i prohibited it the access stopped.

    So, i went to the website — home directory — configuration — in IIS, and then made the extension point to the file in the right directory “c:\program files\php5isapi.dll” (needs the quotes) and it started working.

    Thought i would post my turnaround as well.

    Cheers

  93. Brilliant article – after spending a few hours becoming increasingly frustrated with the windows installer and other guides for installing PHP on IIS6 I now have a fully fucntional system. Many, many thanks.

  94. I actually followed the instructions from http://www.php.net/manual/en/install.windows.iis.php
    I like the idea to keep all PHP related files in c:\php.
    I installed PHP Version 5.2.4 on our dedicated server using “Remote Desktop Connection”. I was getting a “404 File not found” message. I just removed the php.ini file and everything started to work. SO DON’T USE php.ini in the beginning just to make sure you get it works. IN THE php.ini COMMENT “doc_root” line. This is the source of the error message 404 File Not Found.

  95. I don’t have a google account, so this will have to be anon. I followed these instructions and am getting a 500 server error. I rebooted, restarted everything. I don’t know what else to try. Any suggestions would be *very* appreciated.

  96. hi my name is nick. i am having a problem with what you said when changing the path i did so an server reset and after i wasnt able to acses any part of the server frew ftp,mail,teamspeak,remote desktop i had to get me m8 to go into the server it self to change bk to aridginale path

    thxs hope to hear your query about this

  97. Tnx for the manual, except I had to add read rights to the “Network Service”-user to the PHP folder. This user is the user configured in the identity tab of the application pool containing the website. I also had to check the “Replace permissions” checkbox in the advanced security settings screen to reset all persions.

  98. Thank you for all your help. I just installed php but coudn’t find “extension=php_mysql.dll” in php.ini file. So if I use Mysql will it be any problem??
    Thank you again

  99. AAAAAAAHHHHHHHHHHH…..php can be a bear to install….check file permissions. spent two days trying to find out why php wouldnt work with IIS, but asp would…(Not Authorized Errors). Make sure you REPLACE all existing permissions to the php folder to get this to work.

  100. Thanks a lot! Sure you know you have done a very good thing to the World!!! Thanks again, it works perfectly for me with PHP 5.2.5.

  101. This is awesome… I couldnt find anything on the web to help make PHP 5.2 work on IIS6 but it work right after following the directions.

  102. I went through these steps but still facing a problem. I had PHP 5.0.5 running on win2003. I uninstalled it and was installing PHP 5.2.5. I have put everything in c:\php and configured path, IIS-ISAPI and set PHPRC config in environment variables and also in registry.

    But when I run http://www.webkriti.com/clickbank/phpinfo.php

    I get a black page and on view source I can see the php code –

    phpinfo();

    This probably means IIS is showing the php file but not executing it.. where could I go wrong.

    Arijit,India

  103. Worked great, thank you!!!

    After dorking around with PHP 4.4.4 installer (for compatibility with an existing server) and getting permission error over and over, I decided to install latest PHP and found your instructions — it just worked!! KISS, indeed ….

  104. Tjitjing your instructions to install php into win srv 2003 worked perfectly, were clear and right to the point. My my deepest thanks.
    Iuri.

  105. Awesome! I used the PHP 5.2.5 Installer and it didn’t work (as usual). I followed your instructions and removed/added everything that the installer had added then it worked! I think the problem is that the installer puts the DLLs in C:\Program Files\PHP, and when added to the Home Directory -> Configuration, the installer uses the shortened filenames to prevent using spaces, I replaced it with “C:\Program Files\PHP\php5isapi.dll” (including the QUOTES) and it works fine!

    Thanks again for the tips!

  106. Nice tut but, everything worked just fine but in the end on my test.php I get “Invalid access to memory location”. Any clue ? Tryed to google it and I found that php was misconfigured ?!? or …

  107. These instructions are great. I’ve also found a VIDEO Tutorial on this that helps as well.

    You can see this tutorial at http://www.videotutorialzone.com and the name of the video is:

    Installing PHP5 on Windows 2003 and IIS6

    It’s basically what you read here in a video tutorial.

    I hope this helps for people, like me, that find video easier.

    Scott

  108. Hi,
    Hats off to you buddy ! have got the php running on my iis 6 and server 2003 !!! amazing tutorial in its simplicity (given that there is even no screenshots!!!)
    only thing if i could add here is that it might be worthwhile right clicking on the website folder , selecting the documents tab, and add ‘index.php’ as a default document .
    this would enable iis to automatically provide the client with the first index.php file it encounters in the directory.

    God Bless You !

  109. I would say this is a great tutorial. I noticed some post regarding the getting a Page Cannot be displayed or found error. I initially had the same problem; however, my problem was resolved by adding the PHP extention to the specific website I was going to run the php on. Originally I added the extension to all websites however for some reason my websites were not inheriting.

    Thanks.

  110. Anyone have any advice on replacing php and mysql on a 2k3 server, iis 6, with InsPanel? It appears all files have to be in the InsPanel directory for any of this to function. Unfortunately, with my trying to install both versions now nothing works that is php-based.

  111. After days of fighting with PHP using complicated tutorials, I found this easy 1-2-3 way of making it work on Windows Server 2003 (SBS). After following this to a T, MySQL 4.1 loaded right in and connected without any other configuration.

    There is only one hitch with the tutorial that I’d like to comment on before the post below get’s lost too far down:

    I quote Dave –
    “could you amend step 4b to make clear that the extension entered is “.PHP” and not “PHP”, otherwise the OK button remains greyed-out”

    Thanks millions Max Flodén 🙂

  112. I am getting an Access Violation from many (but not all) attempts to access WP/PHP on my server. I have posted about it here and here.

    I would love to hear any suggestions which might prove valuable.

    James

  113. Fixed.

    There was something from PHP4 that was mucking things up. Once I scoured through and removed anything related to PHP4 I came to a different error which was much easier to fix (changing the extensions path from ./ext to c:/php5/ext).

    Now it looks to be fully functional.

  114. WOOO HOOOOO! I beat my head up on a wall for three freakin days and could not get this sh*t to work. Finally, a tutorial that works in FIVE steps.

  115. I’ve seen a number of tutorials for loading PHP 5 in a windows server. All are pretty much the same, but I’d add PECL to yours, and this registry step taken from http://www.peterguy.com:

    This is so that PHP can find its configuration file (php.ini). To make it easy on you, modify the following text so that “C:\\PHP” is the folder in which you’ve unzipped PHP, then copy the text and paste into a new text file (anywhere; the Desktop is a good place to create it). Rename the file to inifilepath.reg, then double-click on it, click “Yes” to the confirmation dialog, and the value will be in place. You can then delete inifilepath.reg.
    Make sure all backslashes are escaped in the .reg file (ie. \\ instead of just \)

    Windows Registry Editor Version 5.00 [HKEY_LOCAL_MACHINE\SOFTWARE\PHP] “IniFilePath”=”C:\\PHP”

    NOTE: PHP also uses other settings to find its configuration file; one of the most notable being the PHPRC environment variable. I prefer using the Registry because by varying the key, you can configure different versions of PHP to run side-by-side on the same machine. See http://us2.php.net/configuration for more information.

    I’d really like to know if anyone has mime_magic working properly on a windows server.

  116. For those getting the 404 errors (and maybe other problems too), the issue for me (Win2K3Server) was that the installer package (msi he says won’t work) uses “%System Drive%/Program Files/PHP” as default install location, and then the windows shorthand for the registration of the dll in step 4.b. If you simply browse to the full location and enclose it in quotes after selecting the isapi dll, all seems to work fine.

  117. One additional step that was critical for my installation:

    In IIS Manager – right click the website folder and select ‘Properties’

    On the ‘Home Directory’ tab, select the ‘Configuration’ button

    Within the list of Application extensions, .php needs to be added:

    – Select ‘Add’
    – browse to and select the php5isapi.dll file
    – enter .php as the extension
    – select ‘Ok’ to all windows.
    – Note: you may or may not need to restart the website

    This assumes youve done everything else outlined in this tutorial as it is stated.

    Good luck!

  118. Thanks for the Post,
    I am just having one problem, when I try to open the test.php page, my browser asks if I want to open or save the file.

    Any Ideas?

    Thanks,
    Torrey

  119. THANK YOU, THANK YOU, THANK YOU

    It worked perfectly. You may also want to mention that after you install and/or edit php.ini, you need to go to the command prompt and execute “iisreset”. This restarts server and loads PHP with new ini settings.

  120. Have a question. As a test, I want to install this on my workstation, first. Running Windows XP with IIS6. This sounds like it should work fine, though. Do you know if it will? also, I’lve already got ColdFusion MX7 Server installed on this machine, a Developer version. Will this cause any conflicts? And lastly, once I’ve installed PHP, can you suggest good instructions for installing MySQL? Thanks, WCW

  121. Hey, thanks so much for an easy tutorial. I found this after some experimentation with trying to get it set up correctly, but your tutorial got me away from the IIS/CGI path, which is evidently less secure, and onto the IIS/ISAPI path, and now it’s set up perfectly … and working!

    By the way, I used ver 5.2.6 installer (msi) and it’s fairly straight-forward. It now takes care of much of what you mention automatically … it helps to run the installer again for “repair” if you find that some extentions aren’t working right outta the gate, and it also helps to reboot the server once the installation/repair is complete.

    Thanks again!

  122. Man, Great job with the clear and perfect instructions.
    The setup went like clockwork.
    Appreciate it!!!
    THANK YOU… A TON 🙂

  123. THANK YOU
    Man you did a great job!
    Your instructions were really easy to follow.
    1st time I ever got php to work.

  124. ı have followed your writing for a long time.really you have given very successful information.
    In spite of my english trouale,I am trying to read and understand your writing.
    And ı am following frequently.I hope that you will be with us together with much more scharings.
    I hope that your success will go on.

  125. Gr8 tutorial!. with the help of this i am able to configure PHP with IIS server runing .NET Websites. thanks

  126. TQ very much..your step is very² simple and i manage to solve my problem withing a few minutes

    i’ve been trying to solve this for a day..once i found ur tutorial, its really help me a lot

    TQ once again, really2 mean it

    regards,
    julianna
    malaysia

  127. I think maybe a revision is in order. You need to include the info from
    armedmetalica
    “I got a 403.1 about executing scripts — make sure you go to the Home Directory tab in IIS website properties and set Execute permissions to Scripts and Executables.”
    and alos this:
    I was also getting the HTTP verb used to access this page is not allowed.
    I fixed that by going to “home directory” tab and clicking “configuration” I then added the php extension, with the path to the phpisapi dll and things worked perfectly.

  128. Thanks a ton man. Why do all the other sites make this so hard to understand? Its simple. You got me running in 5 mins. MUCH appreciated!

  129. THANK YOU! I went through multiple tries based on useless info until i stumbled onto your page. Excellently done. Thank you again.

  130. Great! Your instructions were really simple,clear and effective.I got it.Thank you very much.Wish best thing to you.

  131. It worked! Been trying to get this fixed for a couple of days. These were by far the simpliest instructions on the web and very easy to read. Why do some people have to make things so complicated when it’s really not! Thank you!

  132. Very good guide! But I am using postgresql and have enabled some extensions in the php.ini file, but I have the same message that I read over, but it was “Call to undefined function pg_connect”.

    Which .dll file should I copy to the system32 folder if anyone?

  133. Ugh.

    Don’t be a dum-@ss like me. Ensure you comment out the ‘phpinfo’ entry in disable_functions before trying to test with it.
    :/

  134. Awsome instructions. i’ve used these to configure a new IIS machine for the company i am currently working at. Had to configure IIS with PHP 5.2.9.9 with both MySql AND MSSQL support, and like you can imagine, this is a complete disaster to install and configure. I also managed to install PHPmyAdmin to manage the MySql server installed on the same machine. After day’s of moving around some dll file from here and there (in the c:\php, c:\php\ext and c:\windows\system32 ) and some tinkering in the php.ini file ( uncommenting extensions etc. ) i’ve managed to get it all working. These instructions really helpt me get going. Now all that is left for me to do is document every step of the install and config, for the admins here that don’t really have experience with installing and configuring such a bizzare W2k3 webserver. Thanks for this post.

    Greetz from The Netherlands.

  135. my win 2003 web server is configured with PHP 5.2.6. this version has some vulnerability and I hope to upgrade to the latest version. can any one tell me how to upgrade. thanks in advance.

  136. Great article. Struggled with this one and wanted to share…
    Error 404 Page Not Found – MediaWiki Install on IIS 6.0, PHP, Windows 2003, FastCGI
    I had some trouble resolving the error 404 Page Not Found
    Resolution
    IIS virtual directory configuration: On Home Directory tab, click on Configuration and add Application Extension Mapping for php. The entry must be “.php” and “C:\WINDOWS\system32\inetsrv\fcgiext.dll” for FastCGI, otherwise use c:\php\php5isapi.dll.
    My version of fcgiext.ini had incorrect [Types] section… Should be (verify php path on your install)

    [Types]
    php=PHP

    [PHP]
    ExePath=C:\PHP\php-cgi.exe
    InstanceMaxRequests=10000
    ActivityTimeout=600
    RequestTimeout=600
    EnvironmentVars=PHP_FCGI_MAX_REQUESTS:10000,PHPRC:C:\PHP\

  137. сделал все так и всеравно не открывает он php может еще где-то настройка по умолчанию мешает ?

  138. Thanks so much, man they should have your instructions with the PHP download and not the random nonsense they include.

  139. Totally agree with previous post from Brett…your instructions were awesome. 5 simple steps is all it took. Like you, I found plenty of websites with instructions but all had “issues” or were overly complicted (and intimidating). Followed your 5 steps and had it working in less than 15 minutes. THANK YOU!!!!

  140. This is the easiest and the only one actually worked at once. Congratulations. ASP really sucks and it’s dead meat in my opinion, php it’s the way to go. I spent 95 bucks in a jmail component for ASP, so I can use my fancy flash contact form, PHP is free, fast, stable and it’s the way to go.

  141. I have a problem …. I use php-5.2.10 and windows 2003 server
    after i follow the instructions and run the file containing , the result as I expected but after changing the configuration of php.ini and restart IIS. I can no longer run the file containing , the view that I can empty ….. please help me ……

  142. Thanks a bunch for this – had it all set up correctly except that I didn’t add the php ext to my default website.

    So thank you for saving me a lot of time!

  143. If you are replacing PHP ver 4 with ver 5, you should rename the old c:\php folder, then create a new c:\php folder to unzip the zip file into. In IIS you have to change the .php web service extension from c:\php\php.exe to c:\php\php5isapi.dll. Your PATH variable should already contain c:\php. You also have to change IIS properties (home Directory…configuration…Mappings and change the php.exe to php5isapi.dll.

  144. works now.. durp! should add edit php.ini-recommend to php.ini and maybe some information on folder permission.. other then that thanks for the tut!!

  145. Hi. It’s fun to see such an old thread still being active. Not much has changed. Installing PHP on IIS hasn’t been easier.

    This guide is pretty good though I can’t see anhything on setting NTFS rights anywhere which I thought you needed but the part where you need to add php to the application pool is so simple explained but a haze in the official install.txt And don’t you need to reboot after adding C:\PHP to your PATH?

    Also – the install.txt that comes with PHP does not explain that ISAPI is not supported anymore (that’s why the file isn’t there in the Zip container) so when you read through it for help skip the ISAPI parts. As mentioned in ealier posts. Use FastCGI.

    When you download Windows binaries from php.net it doesn’t explain the difference between the thread safe and non-thread safe – why would you even need non-thread safe anyway?

    Just my 2 cents.

    Tnx for guide 🙂

  146. all installed and looks like it is working but any php page keeps asking for a pass word.all the passwords i have put in don’t work.can you help me out please
    regards derek

  147. Really Thanks From bottom of my heart dear, i was really searching for easiest way to configure php server, 1000 of thanks…! Ali from Baluchistan.

  148. I can’t find a php5isipi.dll file just a php5.dll what am I doing wrong? Also although I can read the file in a browser putting the path in the local host mapping does not work….. I am really confused!

  149. You need to go to the museum.php.net to get an older build. Current versions of PHP 5.3 and above do not have php5isapi.dll file in them. You can find them in the 5.2.17 or below. They expect you to use php-win.exe or php-cgi.exe for handling php processing on the local machine.

    Hope this helps anyone doing a current build.

    Best Regards,
    Doc

  150. I am actually thankful to the owner of this site who has shared
    this fantastic piece of writing at at this time.

  151. Hello! Do you know if they make any plugins to help
    with Search Engine Optimization? I’m trying to get my blog to rank for some targeted keywords but
    I’m not seeing very good gains. If you know of any please share.
    Kudos!

Leave a Reply

Your email address will not be published. Required fields are marked *