Cannot load mysqli extension. Please check your PHP configuration...I'm lost...

Posted on 2008-10-15
Last Modified: 2013-12-13
I just sent up WAMP and when I go to phpMyAdmin, I get this error message: Cannot load mysqli extension. Please check your PHP configuration. I've seen a couple of different possible solutions and I wanted to get some direction before I started popping the hood and pulling wires.
Question by:brucegust
  • 3
  • 2

Author Comment

ID: 22727834
I'm running IIS on port 1080 and it's working great. WAMP is functioning fine, as far as I can tell in that the "localhost" comes up fine etc. But phpMyAdmin doesn't even blink. I know this isn't a new problem because I've seen a number of threads, but thus far nothing has helped including removing the ";" from the extension directory in the php.ini file.

Is there some ninja out there who can make my life a little better by solving this quandary?
LVL 29

Expert Comment

ID: 22728417
As stated at page,
<<PHP 5+
MySQL is no longer enabled by default, so the php_mysql.dll DLL must be enabled inside of php.ini. Also, PHP needs access to the MySQL client library. A file named libmysql.dll is included in the Windows PHP distribution and in order for PHP to talk to MySQL this file needs to be available to the Windows systems PATH. See the FAQ titled "How do I add my PHP directory to the PATH on Windows" for information on how to do this. Although copying libmysql.dll to the Windows system directory also works (because the system directory is by default in the system's PATH), it's not recommended.

As with enabling any PHP extension (such as php_mysql.dll), the PHP directive extension_dir should be set to the directory where the PHP extensions are located. See also the Manual Windows Installation Instructions. An example extension_dir value for PHP 5 is c:\php\ext

Note: If when starting the web server an error similar to the following occurs: "Unable to load dynamic library './php_mysql.dll'", this is because php_mysql.dll and/or libmysql.dll cannot be found by the system.
So you need to:
-uncomment the line in php.ini [you probably did... but beware: there are several php.ini in various directories, the trick is to find the rtelevant one!]
- check that php_mysql.dll and/or libmysql.dll are at the correct place
- RESTART Apache (I often forget this one!)

On my own machine (your mileage may vary):
- in C:\xampp\php, file php.ini has around line 627
- around line 640
BUT note that your probably don't need PDO AND that there is an issue with PDO, you might need to change this dll.

Once everything is OK and apache restarted, look at your phpinfo from your XAMPP html page at http://localhost/

Author Comment

ID: 22737254
OK, I think we're making progress, or at least I understand the logic behind the problem I'm having.

First off, as far as the path is concerned, I have this under my Environment Variables:

C:\Program Files\PHP\;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;C:\Program Files\QuickTime\QTSystem\

When I go to C:\ProgramFiles\PHP\, the only file that is there php.ini. That seemed like a possible cause for concern if the system is looking there for libmysql.dll

The directory where libmysql.dll is located is C:\wamp\bin\php\php5.2.6\. Do I need to change anything in my Environment Variables? As an experiment, I did swap the seemingly incorrect address out with the accurate one, but it didn't seem to make a difference. Also, under on my phpinfo page, I have as the _SERVER["PATH"] the same address (C:\Program Files\PHP\;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;C:\Program Files\QuickTime\QTSystem\) and I didn't know if that was something else that needed to be changed.

I checked for the correct location of my extension_dir and that's good to go.

As far as my list of extensions, here's what they look like on my php.ini file (I just copyed and pasted the revevant ones):


I don't know how to restart Apache, but other than that, I'm thinking it's the path that's the problem. Yet, I'm not sure what to change. Do I change the ini file or just my Environment Variables or do I change anything at all?


LVL 29

Accepted Solution

fibo earned 500 total points
ID: 22743409
1 - A usual trap is that there are several php.ini on the machine! And not sure which one is the one selected!
2 - c:\programs\php is NOT the directory where your XAMP php runs from... it is presumably C:\wamp\bin\php\php5.2.6\
I would suggest that you look for a php.ini there and, if there is one, then check that the mods you meant to make... are done. (rename c:\programs\php\php.ini to php.ini-old)
3 - to stop / start Apache: look at the *.bat files ic c:\wamp
If you stop and restart you computer, apache will relaunch.

Author Comment

ID: 22749249
Renamed the old php.ini file, changed the PATH like you suggested then restarted the computer which is something I hadn't done last time and now we're running along beautifully.

Now I just to learn php and MySql...


Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

820 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question