Link to home
Start Free TrialLog in
Avatar of elreteipos
elreteiposFlag for Belgium

asked on

phpMyAdmin: cannot load mysql extension

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:

(quote)
extension_dir = "C:\Webserver\php\ext"
(...)
extension=php_mssql.dll
extension=php_msql.dll
extension=php_mysql.dll
(unquote)

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:

(quote)
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.
(unquote)

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?
Avatar of AndyAelbrecht
AndyAelbrecht

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 ?

cheers
Andy
Avatar of elreteipos

ASKER

> 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

extension=C:\Webserver\php\ext\php_mysqli.dll

and

extension=php_mysqli.dll

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:

(quote)
[MySQL]
; 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
; at MYSQL_PORT.
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
(unquote)

It's almost the same for MySQLi.
ASKER CERTIFIED SOLUTION
Avatar of AndyAelbrecht
AndyAelbrecht

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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

extension=C:\Webserver\php\ext\php_mysql.dll

to

extension=php_mysql.dll

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 !

cheers,
Andy