Set up IIS 7 w/ MySQL and PHP 5
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 php.net i downloaded a 64bit version from http://www.fusionxlan.com/PHPx64.php, 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 http://www.php.net/downloads.php.
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: http://dev.mysql.com/downloads/mysql/5.1.html
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.
Symptom:
Warning: Unknown: Failed to write session data (files). Please verify that the current setting of session.save_path is correct () in Unknown on line
Solution:
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




February 27th, 2008 at 5:16 pm
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
February 27th, 2008 at 5:38 pm
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
http://localhost/test.php
but if I write the code in this way:
#html>
#head>
#title>PHP Information#/title>
#/head>
#body>
#?php phpInfo(); ?>
#/body>
#/html>
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
XO
March 5th, 2008 at 7:54 am
It seems you saved the file as test.html instead of test.php… check it out.
May 19th, 2008 at 10:47 pm
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
May 20th, 2008 at 6:55 am
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?
May 20th, 2008 at 3:45 pm
Vista 64… sourced PHP from http://www.fusionxlan.com/PHPx64.php, php-5.2.5-x64-2007-11-12.zip.
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
May 20th, 2008 at 5:13 pm
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..
May 20th, 2008 at 6:34 pm
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?
June 2nd, 2008 at 9:45 am
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.
June 4th, 2008 at 5:07 pm
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.
July 21st, 2008 at 10:36 am
copy cat? cant make your own content…
pethtic
http://blondr.blogspot.com/2006/11/set-up-iis-7-w-mysql-and-php-5.html
July 21st, 2008 at 10:38 am
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..
February 9th, 2009 at 3:29 pm
@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.
February 28th, 2009 at 7:21 pm
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.
August 20th, 2009 at 5:40 am
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
Regards,
Sharon.
September 25th, 2009 at 3:08 am
Amazing, works fine for me. Thanks for posting this!
Stefan
October 9th, 2009 at 3:32 am
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 :
;C:\PHP;C:\PHP\Ext
(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.)
October 19th, 2009 at 7:00 pm
[...] post by InteRiders and syndicated here by [...]
December 3rd, 2009 at 4:13 pm
I cannot believe it you solved my problem and I don’t know how to thank you. THANKS!!!☺☻
January 20th, 2010 at 6:51 pm
Incase anyone wants a tutorial for IIS7 on Windows Server 2008, for Movable type 4.xx, please checkout this tutorial I just finished:
http://iainlbc.com/2010/01/install-movable-type-4-on-windows-server-2008-with-iis7-php-perl-cgi-mysql/
Thanks for letting me post EGBlue – Just here to help everyone as you are.
September 1st, 2010 at 8:42 am
Many thanks. Saved me a lot of time. It works.
September 12th, 2010 at 10:20 pm
plz snd me iis for istalling in window vista inspiron1545…for working in dot net
November 29th, 2010 at 11:28 pm
dude thats was fucking n1!!!!!!!!!!!11 it worked for me in win7
February 22nd, 2011 at 8:43 am
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.
February 22nd, 2011 at 9:14 am
FYI, WTF, this is the original post. The copies are the rest.
March 5th, 2012 at 1:02 pm
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.”
November 18th, 2012 at 3:56 am
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!
!