Connecting PHP to MySQL on Windows

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

I have installed MySQL 5.1.52, Apache 2.2.15 and PHP 5.3.2 on my Windows
Vista computer.
The MySQL works fine with the command line client and I have tested the
Apache and PHP and it appears fine when I test this with the phpinfo()
function.  There is just one exception - I cannot connect to a MySQL
database from within a PHP script.  I have installed the MySQLi extension

With a simple script such as:
<?php
$link = mysqli_connect('localhost', 'user', 'my_password', 'my_db');

if (!$link) {
    die('Connect Error: ' . mysqli_connect_error());
}
?>

I receive the following error message in the php error log:
[06-Jan-2011 16:38:35] PHP Warning:  mysqli_connect(): [2002] A connection
attempt failed because the connected party did not  (trying to connect via
tcp://localhost:3306) in C:\Program Files\Apache Software
Foundation\Apache2.2\htdocs\php\connect_error.php on line 19

[06-Jan-2011 16:38:35] PHP Warning:  mysqli_connect(): (HY000/2002): A
connection attempt failed because the connected party did not properly
respond after a period of time, or established connection failed because
connected host has failed to respond.

 in C:\Program Files\Apache Software
Foundation\Apache2.2\htdocs\php\connect_error.php on line 19

[06-Jan-2011 16:38:35] PHP Fatal error:  Maximum execution time of 30
seconds exceeded in C:\Program Files\Apache Software
Foundation\Apache2.2\htdocs\php\connect_error.php on line 19

My php.ini file has the following lines re extensions :

[PHP_LDAP]
extension=php_ldap.dll
[PHP_MYSQLI]
extension=php_mysqli.dll
[PHP_OPENSSL]
extension=php_openssl.dll
and there are no error message that it cannot find the extension. These are
in the windows path and in the extension directory specified in php.ini

I have checked the firewall but it seems to be ok and the mysql server and
apache server on the same machine.
I have installed this correctly in the past but am having no luck with this
installation.

Any hints of where to look and what to try would be most welcome.

regards

Mike
michaelgmanning@xxxxxxxxx

[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux