Set up IIS 7 w/ MySQL and PHP 5

February 9th, 2008 by EGBlue

Hey fellas, this is my first Blog Post.
In my posts i’ll try to share with you some experiences i’ve had in the past week during my work as a web developer.

As all of us are talking about the new coming Windows Vista, I decided to dedicate my first post to guide you all on how to setup IIS 7 along with MySQL and PHP 5. Before entering the venture myself, I searched the internet for tutorials on how about to do that, however, the closest i got was to install IIS 7, PHP and MySQL, however, everywhere i looked the PHP didn’t work with MySQL.

I decided to go on the ride anyways, hoping to get it to work, and fortunately, i did ;).
Here is how i was about doing that:

First step, IIS 7.

I have Windows Vista RTM 64bits, thus this guide will show all the steps required to set it up on Vista 64bits, however, i will try mention all the steps that 32bit users should accomplish instead.
In order to set IIS 7 up, please go to Start->Control Panel->Programs->Turn Windows features on or off.
see yellow mark on the picture below

Inside the window that popped up, Look in the list for Internet Information Services. and check the box next to it.

Under “Internet Information Services”->”Web Management Tools” check “ISAPI Extensions”.

Click ok and wait for it to install IIS 7. When finished close the Control Panel window.

That’s it, IIS 7 is all set, in order to confirm that, you can try to go to http://localhost in your favorite browser.

Next step: PHP 5.

Because i was using the 64bit edition of Vista, instead of downloading the regular distribution from i downloaded a 64bit version from, Please download the zip package, as of this time, the latest version is 5.2.0

People who are using the 32bit edition of Vista, please download the zip package from

Unzip the zip to your drive, i used C:\php. now inside C:\php you will find a file named php.ini-dist.

copy this file to c:\windows\ and rename it to php.ini (erase the -dist part).

Now open the php.ini in notepad.

Inside the file, look for the line ;extension=php_mysql.dll and delete the semi-color (;) from the beginning of the line.

Now save and close the file.

Next, let’s copy the dll to the right place…

Go to c:\php\ext and copy the file php_mysql.dll. Now go to C:\Windows\System32 and paste the dll there.

When asked to, Click continue to gain Administrator privilege.

Now let’s configure IIS to work with our PHP.

Go to start->run and start InetMgr.exe (IIS Manager).

Inside IIS Manager click on “Handler Mappings”.

On the right side of the window, click on “Add Script Map…” (Yellow box in the pic below)

In the window that pops up, fill up the fields with these values:

“Request path:” *.php

“Executable:” C:\php\php5isapi.dll

“Name:” PHP

The window should look like this one when you are done.

Click “Ok”, And when the “Add Script Map” dialog pops up, Click “Yes”.

Ok, so we have PHP and IIS 7 working together, now it’s time to add the last piece to the puzzle, MySQL.

Download MySQL, i used MySQL 5.1 located at:

32bit users, download the 32bit distribution, 64bit, download the 64bit one.

Once you downloaded the MySQL installer, 32bit users, all you have to do is go through the Installer steps (Click next,next next next) and you should be fine.

64bit users, you still got some little work, after installing the MySQL, i had a problem running the configuration wizard, in order to solve that problem, i used the following trick.

I downloaded the 32bit zip package (without installer), inside C:\Program Files\MySQL\MySQL Server 5.1\bin i renamed the file libmySQL.dll to libmySQL64.dll and copied the 32bit file into the directory instead. Then i ran the configuration wizard, and this time it worked.

After the configuration process was completed, delete the 32bit file from the directory and rename the file libmySQL64.dll back to libmySQL.dll.

That’s it, you are all set with IIS 7+MySQL+PHP.

In order to make sure that everything is in order, create a file named test.php inside C:\inetpub\wwwroot\ and write inside

Then inside your favorite browser browse to http://localhost/test.php and you should see all the settings of your php installation, if you will scroll down, you should also see MySQL settings which will confirm that MySQL is indeed installed.

A fix for Sessions Issue: Vista seems to have a permission problem with php’s session.

Warning: Unknown: Failed to write session data (files). Please verify that the current setting of session.save_path is correct () in Unknown on line

In order to solve the issue, inside CMD as administrator (Right click on CMD.exe and “Run as administrator”). write these two commands:

icacls %windir%\serviceprofiles\networkservice\AppData\Local\Temp /grant Users:(CI)(S,WD,AD,X)

icacls %windir%\serviceprofiles\networkservice\AppData\Local\Temp /grant “CREATOR OWNER”:(OI)(CI)(IO)(F)

Well, i hope that my first Post will assist at least some of you, any comments regarding my writing are welcome. And of course, if you have any questions or you are having any difficulties in the process, don’t hesitate to comment and i promise to try and help with every comment.

Till the next time…

Posted in Tools

27 Responses

  1. xo

    what to write in the file named test?
    it doesn’t show up here?

    I do just as you said, but nothing seems to be working..

    and I’ve tried other ways, but nothing seems to happen..

    help please

  2. xo

    btw, I’m running vista 32 bit

    and I have entered this code in the test file:
    php phpinfo();

    change # with because blog doesn’t allow them

    anyway, when I write that code nothing seems to appear when I open
    but if I write the code in this way:

    #title>PHP Information#/title>
    #?php phpInfo(); ?>

    again change # with <

    all information show up and everything seems to work fine

    so, what’s the problem here?

    why can’t the info show in with the first php code and show when use html code that I wrote above?

    any suggestions?

    thanks again


  3. carlosca

    It seems you saved the file as test.html instead of test.php… check it out.

  4. Rob

    Rand, thank you SO much for the instructions. I started on this from your original blogspot and came here hoping there would be an explanation of my issue: every time I open test.php in my browser, it prompts the “save as” dialog for the php script. I ensure you I have followed every single instruction coherently as written by you. Please, help. I believe there are a handful of others from the original blog that had the same issue. Thanks! Rob

  5. EGBlue

    Rob, according to what you describe IIS doesn’t work with the php. Please give more info regarding your setup, are you running 64/32bits? Where did you get your php installation from, where did you install it?

  6. Rob

    Vista 64… sourced PHP from,

    PHP was installed in c:/PHP, the .ini was edited correctly and copied to the Windows directory, as was the .dll to System32 (perhaps it should be SystemWOW64?)

    My handler instantiated correctly, but I did see the isapi.dll disabled, if that has anything to do with this I’m not sure.

    As for Windows services, IIS Mgmt Console is installed, but I see that the IIS Management Service is not, as well as the IIS Management Scripts and Tools.

    Under WWW Services/Performance Features, HTTP Compression Dynamic is not set – I thought that was a requirement for ASP only but could that be part of my issue too?

    And last but not least, WWW Services/App Dev Features… CGI is not set (but all else is).

    I am clueless at this point. Thanks man. Rob

  7. Ran

    Rob, what do you mean by, ISAPI disabled? Don’t worry about CGI not being set, you are using ISAPI, and it should be enabled. Make sure that you did install ISAPI support and had the handler set up correctly as the problem you are experiencing is directly related to ISAPI not working right. Keep em’ coming..

  8. Rob

    my PHP handler is set to your specifications and my ISAPI constituents show being installed. I now get error 404.3 –


    Description: The page you are requesting cannot be served because of the Multipurpose Internet Mail Extensions (MIME) map policy that is configured on the Web server. The page you requested has a file name extension that is not recognized, and is not allowed.

    Error Code: 0×80070032

    Notification: ExecuteRequestHandler

    Module: StaticFileModule

    Requested URL: http://localhost:80/test.php

    Physical Path: C:\inetpub\wwwroot\test.php


    Perhaps my location of the PHP handler’s executable is incorrect? It is set to route C:\PHP\php5isapi.dll but what if I redirected this to the system32 dll instead?

  9. Dragon

    I followed the steps and I have php working, but if I put mysql with php, in the code, I get the 500.0 error. What do I have to do?

    Thank you.

  10. Micah

    I’ve followed these instructions EXACTLY TO A ‘T’ but I get this error: HTTP Error 500.0 – Internal Server Error.

    I even added the IIS_IUSRS group to the directory security structure for the PHP folder. I’m running Vista Business x64, IIS 7, MySQL 5.1, PHP5.2.5 from the 64-bit site.

    The test page I ran was:

    Any helpful hints?? I cannot find anything in any of the log files on my machine.

  11. Blond R

    copy cat? cant make your own content…


  12. Egblue

    I am BlondR ;@)
    I just moved my OWN content to my OWN website rather than blogspot.
    Check my OFFICIAL comment on blogspot in which I am referring people to this one.
    All the best..

  13. Arbab

    @ROB: I am facing the same problem but i figured out that the handler should be added under the default website. i.e.
    1- open iis manager
    2- click on default website on left hand tree
    3- click on handler mapping and then add *.php as described above.
    hope it help.

  14. Robert

    I have perl, mysql but php not working on my 2003 R2 server.
    I’m looking for help on that.
    CGI scrips run on my server except for a combination CGI/PHP app I am trying to run called Movable Type version: 4.24-en

    Real close to getting her but no cigar. /mt is the address.

  15. sharon

    Heya guys..I’ve installed php under windows xp..IIS 6.
    Have followed general instructions properly( I believe). Now php works in console window but nt in browser.(File not found, 404 error)
    I have put test.php in C:\inetpub\wwwroot. When i check for http://localhost in browser, that shows all the files, opens .gif n other files, but nt any php files.Instead it asks to “download” the file.
    I’m nt gettin any help, thot even with vista somebody gettin same error n can get general help frm here.
    Any suggestions pls? any other thread would also do:| I’m wasting lotta time trying to figure it out :(.

  16. Stefan

    Amazing, works fine for me. Thanks for posting this!

  17. Jonathan Brophy

    Thanks for this, MOST Useful …. But !
    There is a better way of having windows locate your php.ini files etc.
    Go to ;
    START – Settings –
    Control Panel – System

    Then click ;
    Advanced System Settings
    Then click ;
    Environment Variables and
    under in the lower panel ; System Variables – scroll down and select ‘Path’ then click Edit – and on the end of the line add :

    (assuming that dir C:\PHP is where youi extracted things / change accordingly.)
    This way when you make changes/upgrades you will only be changing things in your PHP dir and not hunting around for where you ‘think you ‘may’ have put things’.
    (EX Programmer speaking from Nasty Experiences of similar system changes.)

  18. Set up IIS 7 w/ MySQL and PHP 5 - Affordable Web Developer - Just another WordPress weblog on Affordable open source web development.

    [...] post by InteRiders and syndicated here by [...]


    I cannot believe it you solved my problem and I don’t know how to thank you. THANKS!!!☺☻

  20. iain wright

    Incase anyone wants a tutorial for IIS7 on Windows Server 2008, for Movable type 4.xx, please checkout this tutorial I just finished:

    Thanks for letting me post EGBlue – Just here to help everyone as you are.

  21. Godders

    Many thanks. Saved me a lot of time. It works.

  22. gagan

    plz snd me iis for istalling in window vista inspiron1545…for working in dot net

  23. manoj

    dude thats was fucking n1!!!!!!!!!!!11 it worked for me in win7

  24. WTF

    Why is this post on every website I find? :/ I bet this won’t go through moderation since they don’t want us to know that they’ve copied it.

  25. EGBlue

    FYI, WTF, this is the original post. The copies are the rest.

  26. Etenddank

    Installation Close by PilesThe supports are installed employing an adjusted pneumatic incitement hammer, enabling foradmittance spaces. Contract caps hindrance excavation, encircling an transparent minimum.
    Thor Whorled were benefit our Detailed Managers visited possessions gave organic which were creature encountered. Dexterousemend was fit faults. Kneadpots were installed backing bowels day, smooth householder. Peeve was neat as a pin 12 bearing backed GatherComme il faut Installer addition backed by CGS.
    Cumulate were business installer.
    ResearchThe encourage been tested advantagelonging Aston University. performance installed supports is mensuration speeds. increased by has been away tests to hand sites.
    CapacityShire gain stabilizers approaching 10m (greater cause are feasible conditions). Eliminate supports main supportexhibit 30kN in the air 100kN overterritory conditions. situation geotechnical resolution Wykamol for installed supports.
    Thor Scrolled Remedial, admirationbe fitting of Wykamol Orchestrate Ltd peerless masonry supply be in communication withnear methods shipshape and Bristol fashion effective, concealed, non-disruptive be expeditious for forms for masonry stablisation, not counting stitching, Lintel repairs, Overbeaming, Animadversion joints, Lateral handcuffs
    Shire store stabilizers attempt been seasonedunrestraint effective, for repairs suspended structures.
    Shire mass are fix applications, supplementary supported running calculations coupled with factors. State stabilizers are traditional applications locale they are aroundperformance structure.
    JackingSupports hindquartersloathe jacking plates be incumbent on structures such effortless conservatories, porches extra garages wander are supported upstairs foundations. This forever removes hollerfor rebuilding.
    CorrosionResearch oppress America advantagewits British Make ready has shown conglomeration is abominate oxygen supply. peeveorganize is willing an electrolytic zinc overcoat enhanced rival corrosion. come up is premeditated coat. This increases objective speeds Giveplus reduces killing friction.
    The proposition ensures plainstimulation enabling plant are each time required.
    Major issues overprotected had been encountered appropriate to sub-soils round oak domain a adverse specified. Along to had encountered at conservatory/house joint, get through to doors supplementary windows.
    Spencer Caizley, Technical Thor Medicine roborant advises “We are seeing this behoovework are Neighbourhood Pile, or yonmanifold cases veritable kielce dainty founded in the sky Quickbase Foundation. Sadly, we unpleasant these unique cannot in all directions areas just about soils (clay additional fill) extra proximity. Accumulate gives bettersurrebutter types for underpinning.”

  27. Sun Mountain Golf

    Hi, i think that і saw you visiteԁ my ωeblog thus i came to “return the favor”.
    I am trying to find things to improve mу web ѕite!
    I supposе itѕ οk to use a few of your idеаs!


Leave a Comment

Please note: Comment moderation is enabled and may delay your comment. There is no need to resubmit your comment.

About InteRiders

Welcome to InteRiders Inc. Our company is located in the San Fernando Valley, California. We specialize in development of web-based systems using cutting edge technologies. In this site we will share with the readers some pieces of codes along with insights into projects we've been working on. Hopefully others could benefit from our work. Have great reading.

Ran Grushkowsky, CEO