We help IT Professionals succeed at work.

phpMyAdmin: cannot load mysql extension

elreteipos asked
Medium Priority
Last Modified: 2010-05-18
I know this is a question that many people ask, but the solution seems not to work for me. When I try to access pMA, I get the 'cannot load mysql extension'-error. I checked php.ini, and the extension paths are configured correctly:

extension_dir = "C:\Webserver\php\ext"

I put these extensions in C:\Windows too, I don't remember why. Also, when I try to install CMS Made Simple, I get this error:

No valid database drivers appear to be compiled into your PHP install. Please confirm that you have mysql, mysqli, and/or postgres7 support installed, and try again.

It's almost the same kind of error that pMA generates, so I need to get this solved so that I can install CMS Made Simple. Any ideas?
Watch Question

Are you using PHP5 with MySQL5 ? You might have problems then because of not using mysqli (watch the i on the end).

If you are not, then you might wanna restart your apache. Ofcourse you have to check out if these files actually exist on your system in the extension_dir (php.ini directive). Set this to the ABSOLUTE path (in Windows) of the directory with the extensions.

hope this helps ?



> Are you using PHP5 with MySQL5 ?
Yes, I am. What should I do? How can I use that mysqli thing?
search for an extension named php_mysqli.dll or mysqli.dll somewhere on your system.
enable (or insert) this in your php.ini file, restart apache (or iis) and see what it does.


I tried both




but it didn't work. (After restarting Apache, of course.)


What should I do now?
tbh, advising you of a solution to this problem, if all previously mentioned do not work, is kinda hard as we are not behind your computer ofcourse. the second thing is (but that's my opinion only) that Apache nor PHP nor MySQL are originally written to work in Windows as production environment.

that said, the best thing you can do is install something like xamp (http://www.apachefriends.org/en/xampp-windows.html) which includes Apache, MySQL and PHP (all latest stable versions) and a very nice control panel with which you can well, control stuff ;-)

this way you will be sure your PHP <> MySQL connection will be made like it is supposed to be made.


The stupid thing about XAMPP is that it's less flexible then if you install everything apart from each other, so I don't want to use that as webserver. Is there no different way to figure this out?

By the way, should I preconfigure this in php.ini:

; Allow or prevent persistent links.
mysql.allow_persistent = On

; Maximum number of persistent links.  -1 means no limit.
mysql.max_persistent = -1

; Maximum number of links (persistent + non-persistent).  -1 means no limit.
mysql.max_links = -1

; Default port number for mysql_connect().  If unset, mysql_connect() will use
; the $MYSQL_TCP_PORT or the mysql-tcp entry in /etc/services or the
; compile-time value defined MYSQL_PORT (in that order).  Win32 will only look
mysql.default_port =

; Default socket name for local MySQL connects.  If empty, uses the built-in
; MySQL defaults.
mysql.default_socket =

; Default host for mysql_connect() (doesn't apply in safe mode).
mysql.default_host =

; Default user for mysql_connect() (doesn't apply in safe mode).
mysql.default_user =

; Default password for mysql_connect() (doesn't apply in safe mode).
; Note that this is generally a *bad* idea to store passwords in this file.
; *Any* user with PHP access can run 'echo get_cfg_var("mysql.default_password")
; and reveal this password!  And of course, any users with read access to this
; file will be able to reveal the password as well.
mysql.default_password =

; Maximum time (in secondes) for connect timeout. -1 means no limit
mysql.connect_timeout = 60

; Trace mode. When trace_mode is active (=On), warnings for table/index scans and
; SQL-Errors will be displayed.
mysql.trace_mode = Off

It's almost the same for MySQLi.
; Default port number for mysql_connect().  If unset, mysql_connect() will use
; the $MYSQL_TCP_PORT or the mysql-tcp entry in /etc/services or the
; compile-time value defined MYSQL_PORT (in that order).  Win32 will only look
mysql.default_port =

i think your problem might be here mate; it says "Win32 will only look at MYSQL_PORT" so i highly suggest u fill in a value here ;-)
3306 would be the standard port for mysql if i remember correctly.

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts


I'll try it, but I saw that field was only empty in the MySQL section, in the MySQLi section 3306 was filled in. Should I disable the mysqli.dll extension and re-enable mysql.dll extension now?


I also messed around and I started a program called php.exe. It said that it couldn't load C:\Webserver\php\ext\C:\Webserver\php\ext\php_mysql.dll (this is no typo) so I changed




I restarted Apache and suprisingly enough, it works now! It seems that the "mysql.default_port" problem was the missing link. Thanks!
you could indeed try that.

also, check your errorlog files (apache) to see if you see anything when apache starts up that involves PHP and MySQL; it might give a warning or an error on startup about which we know nothing.

sidenote: why do you say xampp is less flexible ? it installs your standard mysql, php and apache and after it's installed, you are free to do with the configuration of these programs as you want, meaning you can perfectly tweak it after it's installed ;-)
ow, cool, you fixed it; so the mysql.default_port was your missing link ?

grats !

Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.


Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.