Saturday, November 25, 2006

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...

118 comments:

Jussi said...

Oh yes! I've been trying to get PHP to work on RTM Vista for few weeks now and now it finally works thanks to your post.

It seems like the only different thing you did was to use the dist ini file as template and copy the mysql.dll into windows\system32 folder. Somehow I haven't been able to reference to the file when it was in "ext" folder even though I've set the "ext" folder property in php.ini.

Thanks again!

Joseph said...

How do you manage to have .php and .html files be parsed with the php-module?

Koen said...

Thx for the tut, got PHP and MySQL working. Only problem with the "session bug". I cant get it to work, tried out your cmd line stuff but it gave me something about ID's.

the code i use is:

C:\Users\admin>icacls C:\Windows\ServiceProfiles\NetworkService\AppData\Local\Te
mp /grant Users:(CI)(S,WD,AD,X)
Users: Er is geen toewijzing uitgevoerd tussen accountnamen en beveiligings-id's (dutch version)

Contrid said...

Thanks for the great article.
I was looking for something useful like this to help me configure PHP on IIS7 Server

Marek said...

i didnt manage to make PHP working with extensions like mysql or openssl, in php.ini is everything set corretly, dlls are copied also to windows\system32

but they are stillnot working, core php works

Melle said...

Koen. If you use a Dutch version, maybe the usernames are also Dutch. Try 'Gebruikers' instead of 'Users'.

Blond R: You're genius... I was also struggling with IIS7 and PHP. Thanks!

Jørgen said...

Thanks! That really helped my get PHP and MySQL to work!

But I got a little problem: It seems like IIS7 don't understand css. There is no styles on the webpages.

Please help!

Thanks again!

Jay said...

You are my personal hero, you just solved the problem microsoft wanted to charge me 300 bucks to answer.... *sigh*

Much thanks, and keep up with all the good work

Jeremy

Emma said...

I found a few things I had to do to make this work:
- set ext dir in php.ini to the php/ext folder
- add computername/users permissions to the top folder of each virtual dir website
- copy libmysql.dll and libey32.dll to windows/system32

Jørgen said...

Thanks Emma! That worked just fine! But still got a CSS-problem. Cant got the stylesheet to work. Somebody help please!

Dustin said...

Awesome, I was trying to get this working and now it does, thanks.

David said...

thanks for the great guide, just to say that if you get errors of the kind "Call to undefined function mysql_connect()" try copying "libmysql.dll" from the main php folder into the system32 folder :) (more info here: http://www.siteinaweek.com/installphp5/howto.php) You can use phpinfo() to check if its picking up the mysql module !

Paulus Haryono said...

Thanks for a great tutorial, make my IIS7 now live with PHP and MySql, but still problem with Sessions Issue, can you inform where to start and the step by step to put the 2 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)

Thanks.

Admin said...

thx, this really helpful i was looking for how to install php on iis7 and i found ur blog with this nice tutorial

http://thehiddenguide.blogspot.com/

Marchand said...

Gold star for public service to writing this up. Still a problem, though: While command line PHP commands work, referencing PHP pages through a browser -- independent of MySQL hangs the browser. That is, it just keeps spinning and never delivers the page. Any hints?

EG said...

Hey all, for those of you who were still having problem with the Session. here is a more general fix.
create a file inside c:\inetpub\wwwroot and name it test.php
inside the file write
phpinfo(); between php enclosers
access that file through your favorite browser (IE/FF/etc) using http://localhost/test.php

scroll to the bottom to where it says session.save_path
next to it, it should say something like:
C:\Users\user\AppData\Local\Temp\php\session

copy that path until \Temp. ie:
C:\Users\user\AppData\Local\Temp

now start a Privileged Admin CMD window. to do so, click on Start, in the search box type in cmd. it will show you cmd.exe on top, right click on it and 'Run as administrator'. once in. type these two commands, and replace the word path with what you copied earlier from the page (C:\Users\user\AppData\Local\Temp)
icacls path /grant Users:(CI)(S,WD,AD,X)

and the second line

icacls path /grant "CREATOR OWNER":(OI)(CI)(IO)(F)

just replace the word path and you are all set.

Chandrachur said...

Anyone using MYSQL and PHP using APACHE 2.x.x must copy and paste the php_mysql.dll file from the ext directory of you PHP directory and paste it in the PHPext folder of yours. You can check this by enabling the display_startup_errors = On in your php.ini file and restart the server...

mark said...

56

mark said...

Thanks Blond R, this is just what I've been looking for but I cannot get it working despite 4 attempts!

I've followed the instructions to the letter and everything appears to work fine but when I test it phpinfo() it shows all of the php installation settings but no MySQL. Any ideas where it might be going wrong?

I have Vista 32 and installed mysql-essential-5.1.18-beta-win32.msi

Any ideas would be very much appreciated.

Thanks
MarkP

Joseph said...

Hey man,

This guide rocks, thanks heaps for making it! i was starting to freak when i installed longhorn and there was no way to install PHP/MYSQL :)

Tom said...

TO GET MYSQL WORKING:

this guide did everyting EXCEPT install mysql on my server... finally i figured out you have to copy the library file (libmysql.dll) to the system32 folder as well. it should be right inside your c:\php folder

-Tom

arjen said...

Great! spend a whole day trying even with a few other guides. this one did the trick, thank you very much!

firstcolle said...

hi,
i have do all that you say in the first post, but when i using mysql i have this error Fatal error: Call to undefined function mysql_connect()

what can i do??

Kevin J. said...

Excellent. This is exactly what I was looking for. Thank you so much.

Garrick said...

It's odd, I can't seem to write to C:\inetpub. When I check properties, it's set to read-only. I uncheck it, click apply and ok. When I check properties again, it's set to read-only again. I'm the admin too, what should I do?

rubyred93 said...

Thank you VERY much! After looking for ages on how to setup up PHP 5 in Vista Ultimate this post finally helped.
The only question I have is that my page wont navigate to another one within the site - I get a 404 error saying the file cant be found. Is this something to do with the way I have set up the virtual directory?
Any suggestions?
Thanks again

Nastaran said...

I do this work . but every time I active extention php_mysql.dll in php.ini don't work my php

Steven said...

Has anyone figured out the issue of file uploads. I have a basic form that uses the normal file save scripting but it constantly returns a permission denied error anyone got any ideas. My file_uploads are on in php.ini and permissions for all users is set to full control still no joy. I am assuming its an iis 7 issue rather than a PHP 5.2 issue

Michael said...

to those who can't get php and MySQL to be recognized as an extension, copy libmysql.dll from the main folder of php to system32 along with php_mysql.dll. I was trouble shooting for two days straight!!!!

Pushker said...

it's a great tutor.

thanks.

Pushker said...

it's a great tutor.

thanks.

fatwazzer said...

Help! I have followed the above tutorial and checked and tripple checked what I have done and am positively sure I have followed every step. Yet, I still get the following server error:

Server Error in Application "localhost"
HTTP Error 500.0 - Internal Server Error

Description: The page cannot be displayed because an internal server error has occurred.

Error Code: 0x800700c1

Notification: ExecuteRequestHandler

Module: IsapiModule

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

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

Logon User: Anonymous

Logon Method: Anonymous

Handler: PHP

Most likely causes:

* IIS received the request; however, an internal error occurred during the processing of the request. The root cause of this error depends on which module handles the request and what was happening in the worker process when this error occurred.
* IIS was not able to access the web.config file for the Web site or application. This can occur if the NTFS permissions are set incorrectly.
* IIS was not able to process configuration for the Web site or application.
* The authenticated user does not have permission to use this DLL.
* The request is mapped to a managed handler but the .NET Extensibility Feature is not installed.

What you can try:

* Ensure that the NTFS permissions for the web.config file are correct and allow access to the Web server's machine account.
* Check the event logs to see if any additional information was logged.
* Verify the permissions for the DLL.
* Install the .NET Extensibility feature if the request is mapped to a managed handler.
* Create a tracing rule to track failed requests for this HTTP status code. For more information about creating a tracing rule for failed requests, click here.

More Information... This error means that there was a problem while processing the request. The request was received by the Web server, but during processing a fatal error occurred, causing the 500 error.

Microsoft Knowledge Base Articles:

* 294807

Server Version Information: Internet Information Services 7.0.

Has anyone experienced this problem too? I would be grateful of any advice.

Andrew said...

To whoever was having the CSS problem:

In the IIS manager, check if .css is listed under "MIME Types", if not then under "Actions" on the right click "Add...".
File Name Extension: css
MIME Type: text/css

Reg said...

re-installed iis7 on 32 bit vista.
Problems with my admin section now, i click the link and it goes directly to 401 error....invalid credentials. I used to click admin link and the login screen woiuld pop up.....now just directly to the 401......am i missing a module? is it a configuration problem.....
ur help is greatly appreciated.

Thanx
Krashink

saj said...

Thanks, just what I was looking for to get up and running on my new Vista machine.

Cheers pal

John Mulhern @ Pagoalball said...

I am getting the problem of this. I need help

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: 0x80070032

Notification: ExecuteRequestHandler

Module: StaticFileModule

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

Physical Path: C:\inetpub\wwwroot\test.php
Logon User: Anonymous

Logon Method: Anonymous

Handler: StaticFile

Most likely causes:
Can someone please help me i cant get to the next step from going into Handler Mapping. Please post here or email tornado973@hotmail.com

John Mulhern @ Pagoalball said...

New error someone please help


HTTP Error 500.0 - Internal Server Error
Description: The page cannot be displayed because an internal server error has occurred.

Error Code: 0x800700c1

Notification: ExecuteRequestHandler

Module: IsapiModule

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

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

Logon User: Anonymous

Logon Method: Anonymous

Handler: PHP

Most likely causes:

IIS received the request; however, an internal error occurred during the processing of the request. The root cause of this error depends on which module handles the request and what was happening in the worker process when this error occurred.
IIS was not able to access the web.config file for the Web site or application. This can occur if the NTFS permissions are set incorrectly.
IIS was not able to process configuration for the Web site or application.
The authenticated user does not have permission to use this DLL.
The request is mapped to a managed handler but the .NET Extensibility Feature is not installed.
What you can try:

Ensure that the NTFS permissions for the web.config file are correct and allow access to the Web server's machine account.
Check the event logs to see if any additional information was logged.
Verify the permissions for the DLL.
Install the .NET Extensibility feature if the request is mapped to a managed handler.
Create a tracing rule to track failed requests for this HTTP status code. For more information about creating a tracing rule for failed requests, click here.
More Information... This error means that there was a problem while processing the request. The request was received by the Web server, but during processing a fatal error occurred, causing the 500 error.

Microsoft Knowledge Base Articles:

294807

--------------------------------------------------------------------------------
Server Version Information: Internet Information Services 7.0.

Pentagon said...

You are the king! Thenks!

Stephen Belanger said...

I followed your directions exactly for 64-bit installations, but on my installation, every time I try and load a php file, it would give me an error saying the MIME Type wasn't recognized, so I registered the MIME Type and now it tries to open with the file download dialog.

Alxandr said...

I get this:

Warning: session_start() [function.session-start]: open(C:\Windows\SERVIC~2\NETWOR~1\AppData\Local\Temp\\sess_69994a9d4570b5b3984484fde83d59b9, O_RDWR) failed: Permission denied (13) in C:\inetpub\wwwroot\test2.php on line 2

Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at C:\inetpub\wwwroot\test2.php:2) in C:\inetpub\wwwroot\test2.php on line 2

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at C:\inetpub\wwwroot\test2.php:2) in C:\inetpub\wwwroot\test2.php on line 2

Warning: Unknown: open(C:\Windows\SERVIC~2\NETWOR~1\AppData\Local\Temp\\sess_69994a9d4570b5b3984484fde83d59b9, O_RDWR) failed: Permission denied (13) in Unknown on line 0

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

Stephen Belanger said...

Anyone that gets the MIME Type problem, try FastCGI, it worked for me. Here's a link to how to download and install it.

http://www.iis.net/default.aspx?tabid=2&subtabid=25&i=1345

NetMyWay said...

I was able to install and setup the phpmyadmin on Windows Vista with your help. Thank you.
Can you tell me how to install phpmyadmin on Windows 2000.
Because their is no isapi module with Windows 2000, I used the php-cgi.exe as the php handler/application mapping. I am able to use the program but I get
the error message:
Error in my_thread_global_end(): 1 threads didn't exit
at the bottom of every php page in my phpmyadmin application when I view them in my browser.
(It doesn't happen in my other php applications that use mysql.)
I understand what a thread is but I don't understand why I am getting the error message.
Please help

Cecil H said...

Blond R

Thanks a bunch I have been working on a lamp environment since college. But my new laptop is a bit to new to make the switch. I will say that everything worked out fine thank you. Also I will say that this almost and I mean almost as much of pain in ass to set up as php and mysql on a solaris box. But thanks a bunch. saved me some time and headache.

Alxandr said...

I have a problem... I can't load the extensions located in the ext file... When I run the php.exe file (in cmd) i get that it could not load dynamic archive or somthing and than the path it was searching for, the only thing strange is that that file-path is accactly the correct path... What do I do?

jaccess said...

I was wondering if you could answer what should be an easy question, how do I enable mysql in php 5.2.5?

Because there is no extension=php_mysql.dll in the php.ini file:
;extension=php_mysql.dll
To remove the semi-colon:
extension=php_mysql.dll

Thanks for your help!

Graefen said...

You are THE MAN! Vista/IIS7 has some weird issues like this, so I'm glad someone out there has the time to figure stuff like this out!

Chris said...

So I'm running Vista Ultimate 64 and the most recent 64 bit versions of php and mysql are installed, however I can't get any error other than "Call to undefined function mysql_connect()...". I have tried moving the php_mysql/php_mysqli/libmysql, etc files into the system32 folder, to no success.

Is there someone who knows what the problem is? I'm at my wits end for waiting on an official 64bit php version that has updated mysql drivers. I've tried running 32bit php with IIS set to allow 32bit, but that only results in unending server 500 errors.

To recap, I can run php64 with no problems, but not access mysql commands. The mysql64 server is working just fine, so the only problem I can think of is the communication between php and mysql with the driver files. All help would be appreciated!

Tmacster said...

Thanks for the post. I am new to PHP and MYSQL. I also just purchased a windows vista computer. Your post really helped me get everything setup so I can start working with PHP.

end said...

Hey, Thanks!, Gracias!.
Your blog is the only place where someone can find useful information to have installed and running PHP5 and IIS7.

I just have a problem with the test.php file because Im starting on this and couldnt understand.

If it is useful for other users here I write what you have to include inside that file:

#html>
#head>
#title>Ejemplo de PHP#/title>
#/head>
#body>
#?php phpinfo(); ?>
#/body>
#/html>

Just replace "#" with "<" because blogger dont allow to write this code

peterwu291 said...

Thanks for the effort you put into this. I did everythng you said, and no problems there, until I set up test.php, and if i open in IE, it asks me to save it, and its a txt file. know what im doing wrong?

thanks

rkg said...

Thanks for the information, for installing php mysql on iis7.
I have followed as per guidelines.
Iam able to see phpinfo but no information about mysql.
when i set up connection to mysql database, get the error
fatel error:undefined mysql_connect() function.
I have copied php.ini after removing the ; from the extension=php_mysql.dll line in windows folder.
I have copied libmysql.dll and php_mysql.dll in system32 folder.

Dat said...

first run, mysql creates a table.
and i delete this table. Then try to run again but it can not create any more table. no error report
Any help, please.

Andy said...

Well, it's taken me about 6 months to do it but I'm there!

Why is this so hard to do?!

Thanks Blond R

noox said...

To fix the session problem on a German Vista you have to use 'Benutzer' instead of 'Users' and 'ERSTELLER-BESITZER' instead of 'CREATOR OWNER':

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

icacls %windir%\serviceprofiles\networkservice\AppData\Local\Temp /grant "ERSTELLER-BENUTZER":(OI)(CI)(IO)(F)

Blond R said...

Hey guys, sorry for not replying to many of your posts lately, i've been keeping busy. to all of you who are having problems communicating with mysql or not seeing mysql under phpinfo(); make sure that your php.ini file has mysql uncommented. also make sure you are changing the right path. under phpinfo() you will find the exact path of php.ini, make sure you are changing the right now.
please stay tuned for new posts and how-tos. everything from AJAX to PHP to some other cool stuff.

Redd said...

IMPORTANT!


If you have copied the php.ini to Windows directory, edit the following in it:

Search for:
extension_dir =

and change it to :

extension_dir = "./system32"

NOW it'l show up in phpinfo.

Osvaldo Domingo said...

New error someone please help


HTTP Error 404.0 - Internal Server Error
Description: The page cannot be displayed because an internal server error has occurred.

Error Code: 0x800700c1

Notification: ExecuteRequestHandler

Module: IsapiModule

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

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

Logon User: Anonymous

Logon Method: Anonymous

Handler: PHP

Most likely causes:

IIS received the request; however, an internal error occurred during the processing of the request. The root cause of this error depends on which module handles the request and what was happening in the worker process when this error occurred.
IIS was not able to access the web.config file for the Web site or application. This can occur if the NTFS permissions are set incorrectly.
IIS was not able to process configuration for the Web site or application.
The authenticated user does not have permission to use this DLL.
The request is mapped to a managed handler but the .NET Extensibility Feature is not installed.
-----------------------
I had Inll Vista Bussines 64, Intel Xeon Quad, and did all for this article, but i had the error... Can I do ?

rkg said...

Thanks for the input on PHP and MYsql on Vista. After following your inputs i am able to install IIs7, PHP and Mysql on the machine. I am failing in setting the link between PHP and Mysql. When I check phpInfo(). It does not show me the installation of MYSQL. I am able to work independently on MySQL. I am not in a postion to resolve the issue. Kindly help me in this matter.
Thanks

Osvaldo Domingo said...

Inside IIS Manager click on "Handler Mappings". you need to add Edit Handler Permissins and click in Execute, for Isapi and cgi, show the content for test.php, I'm trying to finish install, but it is difficult

Blond R said...

Hey guys, just wanted to let you all know that from now on I will be posting new posts on my website's blog. http://www.interiders.com/
I've also reposted this post, and will answer any questions that will be posted there as i get email notifications when comments are posted. so if anyone needs my help, please post your questions over there..
thanks all, cya all on my page.

Lynz N Gaz said...

Hi,

I am new to Vista and just as new to IIS. I have successful installed IIS and PHP as suggested but each time I go to http://localhost/test.html or http://localhost/test.php the page render blank. If I veiw the source code it merely defaults to typical HTML info (hearders, body etc).

I would really appreciate anyone's help here......

cheers
Gaz

Plamen Kasabov said...

First of all see if you web site is runnung now. If it is not the cause maybe is the usage of port 80 by another program - often skype. See this post. I think it will help you
http://w3ka.blogspot.com/search?q=skype

jan said...

Thanks alot ;) Works like a charm, only thing I noticed is that PHP is looking in C:/php5/PEAR for possible extension, so one either wants to change that path or use PHP5 as directory name if you want to work with PEAR modules.

Rahul said...

Just in case you have issues getting extensions working fomr ext directory like i had for PHP_SOAP.dll....i changed following in IIS7....

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

"Request path:" *.php

"Executable:" C:\php\php5isapi.dll (change to C:\php\php-cgi.exe)

"Name:" PHP

Antonio said...

Thanks so much !
that was very very helpful !

Lou said...

My method for vista 64-bit, which I believe is neater:

1. Install IIS:
Go to "Turn Windows features on or off".
Tick the box by "Internet Information Services" (so that it is half-filled).
Also tick "ISAPI Extensions" under "Internet Information Services" > "World Wide Web Services" > "Application Development Features".
Click OK.

2. Unzip PHP.
Download the most recent zip package under windows binaries from http://www.php.net/downloads.php (currently "PHP 5.2.5 zip package"). Unzip this to C:\php. In this folder, take off the -recommended from php.ini-recommended.

Now we need to add C:\php to the windows Path. Control Panel > System > Advanced System Settings. Under System Variables, choose Path and click Edit. Add ;C:\php to the end (the semicolon seperates the previous entry). Click OK.

3. Set up PHP in IIS.
Add the Handler Mapping as Blond R says to. Now, the PHP version we have unzipped is 32 bit. To get IIS to run it we go to inetmgr > Application Pools. Click DefaultAppPool, then Advanced Settings on the right hand side.
Change "Enable 32-Bit Applications" to True.

All done. 64-bit IIS7 working with standard 32-bit php.

thinking_much said...

Great post! PHP worked well just following your instructions. Thank you for this.

Mahmood said...

Hey!

I was able to run PHP on my Vista Ultimate after quite a lot of tries. Now that it is working I have a new problem. PHP does not see the mySQL Server up and running. Any work arrounds?

I am using Vista Ultimate 64-bit, mySQL 5.045 (64 bit), PHP 5.2.5 using FastCGI for IIS 7.0.

All the localhost stuff is working great ODBC connections are fine, except that PHP built-in setup does not see mySQL.

I installed OSCommerce and it simply says mysql is not installed on the machine.

Any suggestions?

Vinícius said...

php works nearly perfectly but I refused to place the php_mysql.dll in the windows dir so I configured the php.ini to look for extensions in C:\php\ext. Nothing goes wrong until I try to use mysql with phpMyAdmin for an example and I get the folowing message: "PHP has encountered an Access Violation at 01C4A119", and all php pages stop working until I restart IIS. I also tried to leave the php.ini file in the php dir and changed the Path variable to use C:\php but it keeps loading the php.ini file from C:\windows. I had no choice but to move the php.ini file to the windows dir. Anybody knows how to fix these problens?
I´m using Win Vista Ultimate 32-bit

Chris said...

I've been trying for 3 weeks now to get IIS, PHP and MySQL to work under Vista. I can successfully get PHPInfo to display which shows MySQL installed but as soon as I define a connection to the MySQL database with a recordset, displaying the page causes an Error 500 from the isapi module. Inetpub logs just indicate that it was an 'error 0x0 - operation completed successfully' (big help..) I'm at wits end and any help would be appreciated. I can't begin building anything until I figure out why a MySQL connection

sitlo2 said...

The 32 bit trick for vista 64 bit didn't work for me.
I've still got the 1045 error message.
I am still a newbie in this stuff :D

sorin said...

Like a lot of guys from here I get this error 500.0. PHP works fine but not MySql.
Please BLOND R tell us what to do in this situation, if you know the answer.

Peter said...

simply Thanx Blond R.
it works for my Vista and PHP 5
Great Post. Never change.

Yolande said...

I have a error in IE.... HELP
HTTP Error 500.21 Internal Server Error
Handler "PHP" has a bad module "AnonymousAuthenticationModule" in its module list..


Which mosule should I use?

sorin said...

To solve the problem with IIS7 I did what one of my professors said: I installed wamp and I don't have to deal with any error like 500, 400, etc.
Now I have a server and I can test my web sites without using IIS7.

FS said...

I'm sure you get (don't) get tired of hearing this but your instructions saved me a whole day of headaches for php/sql/II7 install.
Others tried and died in their tedious and odious directions!
Kudos to you and others out their who donate their brain cells to the betterment of human-kind!

Fred Myers
www.dizziedesigns.com

News Key said...

Its a great Help, thaanks a lot

News Key said...

Its a great Help, Thaaanks a lot.

News Key said...

Its a great Help, thaanks a lot

Ian said...

Fantastic guide - after trying to do this for 2 days your guide is so simple & straight forward. Many thanks.

headache said...

well I've tried every tutorial I can find and can't get this to work. I am using a new laptop with Vista Business, installed IIS7 and all seemed peachy. added the script map handler and it all went pear shaped (excuse the pun). any advice gratefully recieved.

Gorka said...

Hey man, thanks for taking the time and helping others. Huge bummer here:
Installed IIS7 did step by step to install PHP and after running phpInfo() script I get a 404 error about IIS not recognizing the file extension.
Any ideas?
Help will be much appreciated.
Cheers,
Gorka

News Key said...

As a matter of fact, I formatted my hard disk, then I installed the Appserv from http://www.appservnetwork.com/.
Dont reinstall the IIS.
Download the appserver from the above link and install on ur machine.
The apperv server runs automatically for you the Apache, MYSQL and PHP.
Your local host will be on the appserv folder of your C drive.
Try it and Good luck

Ryan said...

You may referral to this link.
You problem is the php by default is 32 bit, and your Vista is 64 bit, therefore you need enable this in IIS

Application Pools \ DefaultAppPool \ Advanced Settings… \ (General) Enable 32-Bit Applications: True

By default it’s false.

Cheers,

darren said...

hi my friend, i having a major problem now, i have an red "x" during the last party while executing mySQL instance configuration and it says: " Cannot create Windows service for .Error: 0" what should i do now?

KAFLAN said...

> Joseph said...

> How do you manage to have .php and .html files be parsed with the php-module?

Did any1 find solution for this?

I`m very intersted. If u are, plz post solution here or mail me to: dmitry@kaflan.ru, thx a lot!

tty01 said...

Did not worked for me...

First, the only modern 64-bit compatible version of PHP I've found is php-5.3.0alpha2-Win32-VC9-x64.zip
(http://windows.php.net/downloads/qa/). I'm using Vista Business 64-bit SP1.

Second, there is no file php5isapi.dll inside the archive, so I've installed it in IIS as CGI-module.

Third, any PHP-script returns the following:

Fatal error: Unknown: Failed opening required '-' (include_path='.;C:\php5\pear') in Unknown on line 0

Can't really understand, what IIS needs - "Failed opening required '-'", especially "on line 0".

Ben Margolis said...

This worked! Thanks! The additional step for me was to add the script map to Default Web Site.

ชุลีพร สืบสิน said...

I use 32 bit, but it like your tutorial.

Thanks so much.

C DEEPAK said...

thnks a ton dude..

Giridhar S said...

but i get one mistake mycrpt extension failed to load
just take a lool at http://giridharseel.wordpress.com/

Michal & Eli said...

HELP! I did everything you said, my apache works, the phpinfo gives me all the info - I installed iis7 according to all your instructions... My computer doesn't recognize a php program when you click on its icon it flashes the IE page and then a blue box comes up and asks me if I want to open the program or save (choosing open gets you nowhere)

Siniša said...

Thanks, you're the man.

hal9000 said...

This exact process worked a treat on my windows 7 ultimate x64 install as well.
Thanks

Dailey said...

The creators of Sony's upcoming PlayStation 3 title LittleBigPlanet will deliver a keynote address at the upcoming Paris Game Developers ... online hypnosis
diet plan
learn to speak spanish

crystal sexylingerie said...

Article is very interesting,thanks for your sharing. I will necessarily add it in the selected works and I will visit this site.


plastic machinery
plastic recycling
Granulator
Extruder
Twin Screw Extruder
Extruder machine
Pipe Extrusion System
Profile Extrusion System
WPC Production line
Plastic Auxiliary Machine
Extruder machine
Pallet racking
Racking system
Racking
Pallet rack
Flow racking
Cantilever racking
Light duty rack
Mezzanine rack
Flow Racking
Racking accessories
Racking manufacturer

crystal sexylingerie said...

subject:Led sign,Illuminated Signs,light box and neon sign manufacturer

Article is very interesting,thanks for your sharing. I will necessarily add it in the selected

works and I will visit this site.

Led sign
Illuminated Signs
light box
neon sign
China neon sign
Solar Light Box
Led displays
Solar Gas Sign
Neon sign manufacturer
Solar Light Box
artificial grass
synthetic grass
Aritficial Grass for Landscaping
Fake Grass
Artificial Grass for Sport
Economical Grass for Landscaping
Fibrillated Grass for Sport
Monofilament Grass for Landscaping
Monofilament Grass for Sport

crystal sexylingerie said...

I have read your article.Article is very interesting,thanks for your sharing. I will necessarily add it in the selected works and I will visit this site.

Welcome to my website:

x-ray machine
hospital bed
Autoclave
dental chair
Dental Unit
Infant Incubator
Operating Lamp
Laboratory Centrifuge
Powder Coating
powder paint
Polyester Epoxy Powder Coating
Epoxy Powder Coating
China powder coating
Polyester Powder Coating
Epoxy Powder Coating
Decorative Powder Coating
Pearl Powder Coating
Metallic Powder Coating
Heat Transfer Printing Powder Coating
Heat Transfer Printing Paper
Clear Powder Coating
Transparent Powder Coating
Polyurethane Powder Coating
Acrylic Powder Coating

Shirley said...

your site impresses me with neat structure and apprearance, always like site that shares useful info...

Cheap Beijing tours

Indian Surgical Industries said...

autoclave- manufacturer and supplier of autoclaves and provide quality autoclaves like autoclave sterilizer, vertical autoclave, horizontal autoclaves, autoclave aluminium, autoclave double drum, dental autoclave.

贤重 said...

One summer afternoon, Former President Bill Clinton and his wife Hillary were vacationing in their home state of Arkansas. Jimmy Choo handbags After a long road trip, they stopped at a service station to fill up their car with gas.A blind man, with a seeing eye dog at his side, walks into his local grocery store.Miumiu handbags He walks to the middle of the store, picks up the dog by the tail, and starts swinging the dog around in circles over his head.Mulberry handbagsAn ambitious young blonde woman, in need of money, decided to hire herself out as a handyman-type. She began, door to door, canvassing a wealthy neighborhood for work. She went to the front door of the first house and asked the owner if he had any jobs for her to do.

Son of Tirhut said...

i am a new user, i follwed the steps, but the problem is it has lots of packages to be installed for windows vista-32 bit under IIS 7. please provide me the easiest and shortest method to develop project as online system using database. Hope you'll help me.....Thanak you.

Son of Tirhut said...

i am a new user, i followed the steps, but the problem is it has lots of packages to be installed for windows vista-32 bit, sp2 under IIS 7. please provide me the easiest and shortest method to develop project as online system using database. Hope you'll help me.....Thanak you.

Passive Income said...

Thanks for the config instructions, they worked a treat (PHP has tested fine)!

You wouldn't believe the issues I've had since switching to Vista (from XP).

Thanks again!

doctor said...

This process worked wonders on my windows 7 ultimate version x64 as well.
Thanks!

Wood Grain Powder Coating
wood finish powder coating
wood powder coating
pompano beach impact windows
impact windows
replacement windows

angelw said...

Thanks so very much for taking your time to create this very useful and informative site. I have learned a lot from your site. Thanks!! I think you have done an excellent job with your site. I will return in the near future.
wedding dresses

Muhammad Azeem said...

This is a nice article..
Its easy to understand ..
And this article is using to learn something about it..

c#, dot.net, php tutorial, Ms sql server

Thanks a lot..!

jasonfan said...

According to the law, a wedding dress offen have two steps. The new couple must sign in the registration office to register a

marriage. This is usually held in the workday, participants also include the wittness of marriage , family members and close friends. Then the bride and
bridal online shop will choose another place to host weddings, which offen on saturdays. A special ceremony held outside is also

popular. Some couples chose only parties to celebrate.
“The currently trend of wedding ceremony is that the new couples want to have fewer guests while they can spend a pleasant moments, tastes a high-qulity banquet and also have a

rule on the wearing ”.said by Blair , a wholesale wedding dresses planner in switzerland.
As one of the first wedding planer of the country, Blair have organized and planned the weddings for 12 working years. As far as Blair have concerned, a sucessful wedding has

its secret. “ the most important thing is that the new Lace wedding

dresses
can have their dream came true. They can give a schedule to make clear the activities for the guests.

bu said...

Girl expect to be the most beautiful bride in her wedding. Here we provide plenty of Wedding Dresses, Prom Dresses,Bridesmaid Dresses,Evening Dresses,Celebrity Dresses,Cocktail Dresses,Mother Bride Dresses, etc to help you carry out your dream. Having been specialized in custom-made Bridal Gowns, we can produce dresses in any size and any style. And we have a range of colors to choose, from traditional white colored bridal gowns to other color wedding gowns. And you yourself can decide your own color according to your preferrence. All of our products are of excellent quality and at cheap prices. We will make every endeavor to satisfy our customers.

Jagdish said...

I tried both the following files however still could not find the files "php.ini-dist" inside PHP folder and "php_mysql.dll" inside php/ext folder.
php-5.3.8.tar.gz and PHP 5.3.8 (tar.bz2) [10,928Kb] from the link http://www.php.net/downloads.php

Also is there any specific thing I need to set if I work on server 2008? Currently working on Windows 7

Thank you.

beauty girl said...

Very useful,It's a good topic ! I am glad I was able to read it.Brilliant post Harry! What you have shared to us is interesting-Brand Bayliy Wedding dressthank you for sharing.

kellytang said...

may be vintage wedding dresses the nsatisfactory.maternity wedding dresses The subsequent wedding dresses Xyou how mermaid wedding dresses to aving,colored wedding dresses the election halter wedding dresses for the correct ball gown wedding dresses part of their very own column wedding dress

kellytang said...

may be vintage wedding dresses the nsatisfactory.maternity wedding dresses The subsequent wedding dresses Xyou how mermaid wedding dresses to aving,colored wedding dresses the election halter wedding dresses for the correct ball gown wedding dresses part of their very own column wedding dress

Sarah said...

Thanks for sharing this great content, I really enjoyed the insign you bring to the topic, awesome stuff!

Classifieds php script

lanmeng wedding said...

Article is very interesting; thanks for sharing. I will visit this site. And welcome to wedding dresses online shop. We supply high quality cheap wedding gowns, 2011 Style Wedding Dresses. We have run dress business 20 years and you can trust us completely. Our wedding dresses shop has Princess Wedding Dresses, Ball Gown Wedding Dresses, Strapless Wedding Dresses, Mermaid Wedding Dresses, Plus Size Wedding Dresses and so on. You can find your dream Beach Wedding Dresses here. We do retail and wholesale wedding dresses business. Choose http://www.weddingdressesshop.co.za, get your Prom Dresses, Bridesmaid Dresses right now!

fredjack said...

1.Bridesmaid Dress Fabrics Choose Tips

2.Trends 2012 for flower girl dresses
3.a lot of problem reports about gruesome bridesmaid dresses
4.Have Fun With Complementary Bridesmaid Dresses
5.Cheap Flower Girl Dresses Save Online
6.How to Choosing Plus Size Evening Gowns For Women
7. Looking For a Great Wedding Dress Colors
8.Tea Length Dresses - Mother of the Bride Dresses


1.What Style Cocktail Dresses Suits You
2.Affordable Cocktail Dresses For Womens
3.Flower Girl Dresses
4. Cheap Cocktail Dresses
5.Cheap Prom dresses
6.Looking For Medieval Vintage Prom Dresses
7.Silky Silver Mother with the Bride Dresses


1.The Lowdown on Evening Dresses
2.Excellent Dresses For a Special Prom Party



  wedding dresses
 wedding gowns
 wedding dresses
vogue sky


 wedding 2012 gowns
 wedding dresses
 wedding 2011 gowns
wedding cheap dresses

bridesmaid dresses
formal dresses
david fashion dresses
 wedding gowns

cheap dresses
Bridesmaid Dresses
evening dresses
vogue dresses

cocktail dresses
cocktail dresses
prom dresses
fashion

fredjack said...

designers dress girls with disney romantic wedding dresses cocktail dresses plus size designer evening gowns ball gowns perth square wedding beautiful prom dresses tea length wedding dresses prom dress websites colored wedding dresses strapless prom dresses 2011 sherri hill prom dresses 2011 beach bridesmaid dresses black strapless dress black evening gowns


tea length party dresses prom dresses under 100 gold cocktail dress womens cocktail dresses princess bridal gowns halter dress designer bridal shoes bridesmaid dresses with straps blue wedding dress ball gowns perth mother of the bride suits short dress plus size empire waist dresses tea length plus size wedding dresses off the shoulder sweetheart wedding dresses

fredjack said...

cute prom dresses tea length wedding dresses under 200 mother of bride outfits ball gown dresses dresses for prom bridal wedding accessories best prom dresses fall bridesmaid dresses sweetheart neckline wedding gowns 2011 strapless sweetheart wedding dress vintage prom dresses plus size formal dresses couture prom dresses purple cocktail dresses black strapless dresses