As you know mysql is not compiled into php as of version 4, so you have to do some configuration for your php script to properly communicate with mysql server.
I’m new to php/mysql development environment; at first everything was frustrating and you don’t get the help you require promptly. You have to make the mistake and correct it yourself and write your headaches lie this like me ;)
First I have downloaded php 5.2.4 installer for windows, and I installed it on win xp sp2 with IIS5. And it was working fine. Then I installed mysql 5.1 and this installation was also working perfectly. I tried to access the default databases that come with mysql from command prompt…no problem.!
The problem arises when I tried to access my database from php script (I use phpMyAdmin to manage my databases) Here is the solution I found for my problem:
1. DO NOT use the windows installer from php.net. (At least it didn’t work for me)
2. download the windows binary from php.net
3. Unzip it to c:\php\ folder
4. Open “php.ini-recomended” using notepad and make the following changes:
a. doc_root = "your website root directory";
b. extension_dir = "C:\PHP\ext";
c. uncomment the following two lines (i.e. remove the semicolon)
5. now save the file as php.ini and place a copy of this file in c:\windows (I know its redundant to place two copy of php.ini indifferent places, which can be located by windows using environment variable, but hey it works for me this way)
6. Its time to setup windows environment variable which is used to locate your php installation folder.
a. Right click on “My Computer” icon and select property from the context menu
b. Click the advance tab from the dialog box and click Environment Variable to bring the variable setting dialog box
c. Find a variable called “path” and double click it
d. Now append the following to the path entry- c:\php\;
e. Close the dialog box
7. Now let IIS know how to handle scripts with.php extension
a. Open IIS from your control panel Administrative Tools folder
b. Right click on your default website. And from the dialog box, click on the Home Directory tab.
c. Now click configuration button and on the Application Configuration dialog box click add button to add you extension and its associated module or executable
d. Click browse and add php5isapi.dll path’s
e. And for the extension type “.php”
f. Now click ok and restart your computer.
Should work fine this way!