Solved

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

Posted on 2008-10-15
5
4,104 Views
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.
0
Comment
Question by:brucegust
  • 3
  • 2
5 Comments
 

Author Comment

by:brucegust
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?
0
 
LVL 29

Expert Comment

by:fibo
ID: 22728417
As stated at page http://www.php.net/manual/en/mysql.installation.php,
<<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
;extension=php_msql.dll
extension=php_mssql.dll
extension=php_mysql.dll
extension=php_mysqli.dll
;extension=php_netools.dll
- around line 640
;extension=php_pdo_firebird.dll
extension=php_pdo_mssql.dll
extension=php_pdo_mysql.dll
;extension=php_pdo_oci.dll
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/
0
 

Author Comment

by:brucegust
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):

;extension=php_msql.dll
;extension=php_mssql.dll
extension=php_mysql.dll
extension=php_mysqli.dll
;extension=php_oci8.dll
;extension=php_openssl.dll
extension=php_pdo.dll
;extension=php_pdo_firebird.dll
;extension=php_pdo_mssql.dll
extension=php_pdo_mysql.dll
;extension=php_pdo_oci.dll
;extension=php_pdo_oci8.dll
;extension=php_pdo_odbc.dll
;extension=php_pdo_pgsql.dll
;extension=php_pdo_sqlite.dll
;extension=php_pgsql.dll

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?

Thoughts?

0
 
LVL 29

Accepted Solution

by:
fibo earned 500 total points
ID: 22743409
OK.
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.
0
 

Author Comment

by:brucegust
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...

Thanks!
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

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…
This article discusses how to create an extensible mechanism for linked drop downs.
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

705 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now