Mark Baker
Mark Baker

Reputation: 212452

MySQL on Windows-7 (64-bit) on 0.0.0.0:3306 rather than 127.0.0.1:3306

I've just installed the latest production release of MySQL (64-bit) on my Windows 7 box. It was a straight vanilla install, using all defaults; but phpmyadmin can't see it at all. MySQL is configured as a service to start automatically, and I know it's running because the MySQL GUI tools work correctly.

The actual error message that I'm getting from phpmyadmin is:

Cannot load mysql extension. Please check your PHP configuration. - Documentation

phpinfo() shows:

> mysqlnd enabled 
> Version   mysqlnd 5.0.7-dev - 091210 - $Revision: 294543 $
> Compression supported
> Command buffer size  4096 
> Read buffer size   32768 
> Read timeout   31536000
> Collecting statistics  Yes
> Collecting memory statistics  No

Doing a netstat -a, I see

TCP    0.0.0.0:3306           Marks-Netbook:0        LISTENING

when I'd expect to see

TCP    127.0.0.1:3306         Marks-Netbook:0        LISTENING

I don't know if this is the reason phpmyadmin can't connect, but suspect that it is probably the case. Can anybody confirm whether this is the likely cause, and/or suggest how I can resolve this?

Upvotes: 1

Views: 4645

Answers (3)

Allan Leake
Allan Leake

Reputation: 11

I spent the last couple of days trying to get phpMyAdmin working. My OS is Windows 7 64 bit. The Apache server is version 2.2 (downloaded installer httpd-2.2.17-win32-x86-openssl-0.9.8o.msi). PHP version is PHP 5.3.6 (cli) (built: Mar 17 2011 10:37:07). MySQL version is 5.5 (downloaded installer mysql-5.5.12-winx64.msi).

Everything appeared to install and run correctly. Apache and MySQL were running as a service. PHP appeared to be OK. However after successfully going through the configuration of phpMyAdmin, when I tried to start it I got the “cannot load mysql extension” error.

I combed through a lot of documentation and forums. Thanks to all for posting your experiences. Here is what I tried and how I finally got it working.

Remember that in Win7 /64 bit there are no “Windows” and “WINNT” directories. Apache should be in “Program Files (x86)”, MySQL should be in “Program Files” and I put PHP in folder “C:\PHP”.

One Person advised that the PHP directories be placed at the beginning of the PATH. I figured why not so I opened a command window and edited the path so that the first four entries are:

C:\PHP\;C:\PHP\ext;C:\Program Files\MySQL\MySQL Server 5.5\bin;C:\Program Files\MySQL\MySQL Server 5.5\lib;

Another person advised that in your Apache httpd.conf file set your PHP section to something like this:

LoadFile "C:/php/php5ts.dll"
LoadModule php5_module "C:/php/php5apache2_2.dll"

<IfModule php5_module>
     PHPIniDir "C:/PHP"

    <Location />
        AddType text/html .php .phps
        AddHandler application/x-httpd-php .php
        AddHandler application/x-httpd-php-source .phps
    </Location>

</IfModule>

Ensure that the dll files actually do exist in the directories specified and adjust them if necessary.

However, the final piece of the puzzle is in the php.ini file. You need to comment out the PostGres extensions as follows:

;[PHP_PGSQL]
;extension=php_pgsql.dll

(Thanks to [email protected] in thread http://www.apachelounge.com/viewtopic.php?t=3180 ) for this final bit of information.

If you are working on Win7 64 bit and having trouble give this a whirl.

Upvotes: 1

Charles
Charles

Reputation: 51411

Cannot load mysql extension.

There are no less than three ways to connect to MySQL from PHP:

  1. The "mysql" extension
  2. The "mysqli" extension
  3. PDO

phpMyAdmin seems to want to use the "mysql" extension. Check your php.ini, make sure that the "mysql" extension is enabled. The line will probably look something like extension=php_mysql.dll

"mysqlnd" is the Native Driver for MySQL, and is used by the extensions and PDO to actually connect.

Upvotes: 1

ZZ Coder
ZZ Coder

Reputation: 75486

Listening on 0.0.0.0 means it's listening on all interfaces, including loopback which is 127.0.0.1. So this shouldn't be a problem.

Please post your phpmyadmin config.

Upvotes: 1

Related Questions