This error is due to mysql dlls not being in the right place and the php parser not knowing where to look for the extension dlls….below is my working solution on Vista SP1 and XP SP3.
I have had a hard time getting PHP and MySQL on Windows XP and Vista to actually talk to one another. I have search the web under this post title and found many suggestions, recommendations, and options to try with no success. I finally solved this issue myself, so I thought it best to post it for others to learn from what I did.
The biggest issue with any solution sources out there is lack of screen shots or lack of descriptions of what their actual setup is and not just what they did to solve it. A minor criticism I know.. it is my hope that this post will improve on those very things other posts/web pages missed.
I will provide a bit more detail than just the solution to this error message (which I will denote).
System:
- Windows XP Professional Service Pack 3 installed
- or Windows Vista Home Premium w/ Service Pack 1
- IIS (Internet Information Server) installed and running
- Downloaded the php-5.2.6-Win32.zip file from php.net and unzip this to c:\PHP
- Installed MySQL Community Server (see below) from MySQL.com
- I also installed (and recommend) MySQL GUI Tools found on this page
Once you have unzipped the zip file for PHP into c:\PHP directory you are ready to setup PHP on IIS and then created the conduit for PHP and MySQL to talk to each other.
PHP on IIS setup (**note there is a Windows XP setup and a Vista setup**)
Windows XP Setup (assumes IIS is installed)
PHP Setup Part 1
- Download the php-5.2.6-Win32.zip file and unzip it to c:\PHP folder
- Open php.ini-recommended file in Notepad (or any other text editor)
- Save this file as php.ini in your C:\PHP folder (**NOT in c:\windows as with Apache)
- Search the php.ini file for the line extension_dir = “./”
- Change this to read extension_dir = “c:\PHP\ext”
- Now search for the line in the php.ini file ;extension=php_mysql.dll
- Right below this line there should be the line ;extension=php_mysqli.dll
- Remove the semi-colon from each of those lines
Result:
...
; Directory in which the loadable extensions (modules) reside.
;extension_dir = "./"
extension_dir = "c:\PHP\ext"
...
;extension=php_mssql.dll
extension=php_mysql.dll
extension=php_mysqli.dll
;extension=libmysql.dll
...
PHP Setup Part 2
1. Start Menu –> Run –> inetmgr.exe

2. Expand the tree on the left to show the Website folder in IIS (for PHP5 on Apache Install)

3. Right click on the Website folder and choice properties

4. Click on Home Directory Tab and then click Configuration

5. In the Mappings tab (sorted alphabetically) search for a PHP entry, most likely there is none, so add it
6. Then set the Executable to c:\php\php-cgi.exe and the extension to be php
7. Click Okay
8. Stop and restart IIS
9 . Create a simple phpinfo file in notepad to test your setup.
10. Save this a MyPHPInfo.php in your c:\inetpub\wwwroot\ folder (default setup of IIS)
11. Start Menu –> Run –> http://localhost/MyPHPInfo.php
A page like this should appear:
If not, you may need to restart your machine and try again.