ID:               50939
 Updated by:       fel...@php.net
 Reported By:      jpmasseria at yahoo dot com
 Status:           Bogus
 Bug Type:         MySQL related
 Operating System: Windows Vista
 PHP Version:      5.3.1
 New Comment:

Bug #50172


Previous Comments:
------------------------------------------------------------------------

[2010-02-06 01:10:21] jpmasseria at yahoo dot com

Thank you for your quick response on this.

What is the bug-id of the problem that this is a duplicate of?

Thank you,
John

------------------------------------------------------------------------

[2010-02-05 16:59:54] johan...@php.net

Please do not submit the same bug more than once. An existing
bug report already describes this very problem. Even if you feel
that your issue is somewhat different, the resolution is likely
to be the same. 

Thank you for your interest in PHP.

We can't really fix this issue without causing trouble in the future
(MySQL 5.5 supports IPv6 so changing to use IPv4 only from PHP means
that you're using IPv4 from PHP and IPv6 from the command line which
gives a mess in regards to user rights)

Please use 127.0.0.1 as hostname, or configure your system not to use
IPv6.

------------------------------------------------------------------------

[2010-02-05 16:38:02] jpmasseria at yahoo dot com

Description:
------------
PHP 5.3.1 is unable to connect to MYSQL running on same Windows Vista
machine when host file contains:

::1         localhost   # IP v6 local host
127.0.0.1   localhost


If "::1" line is commented out, test program works.  This issue also
affects phpMyAdmin.  This problem started after upgrading to PHP 5.3.1.

Running "mysql -h localhost" from command line works without issue.

When "::1" is commented out, phpMyAdmin says:

MySQL client version: mysqlnd 5.0.5-dev - 081106 - $Revision: 289630 $

Is this client embeded in php_mysql.dll?

Here is the verion of PHP I'm using:

C:\Users\johnma>php -v
PHP 5.3.1 (cli) (built: Nov 19 2009 10:17:43)
Copyright (c) 1997-2009 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2009 Zend Technologies

Thank you,
John

Reproduce code:
---------------
<?php
echo "Hello there ...\n";

$dbhost = 'localhost';
$dbuser = 'xxx';
$dbpass = 'xxx';
$dbname = 'xxx';

echo "Attempting to connect to host=\"{$dbhost}\"\n";
$conn = mysqli_connect( $dbhost, $dbuser, $dbpass );

if( !$conn ) {
    printf( "Connect to mysqli failed: %s\n", mysqli_connect_error()
);
    exit();
}

mysqli_select_db( $conn, $dbname );
$result = mysqli_query( $conn, "Select distinct date from statistics"
);
if( !$result ) {
    echo mysqli_error( $conn );
    exit;
}

while( ($row = mysqli_fetch_assoc( $result )) != NULL ) {
    echo "\"{$row['date']}\" );\n";
}

exit();
?>


Expected result:
----------------
C:\Users\johnma>php -f test.php
Hello there ...
Attempting to connect to host="localhost"
"2009-04-01" );
"2009-04-02" );
"2009-04-03" );
"2009-04-04" );
"2009-04-05" );


Actual result:
--------------
C:\Users\johnma>php -f test.php
Hello there ...
Attempting to connect to host="localhost"
PHP Warning:  mysqli_connect(): [2002] A connection attempt failed
because the connected party did not  (trying to connect via
tcp://localhost:3306) in C:\Users\johnma\test.php on line 10
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:\Users\johnma\test.php on line 10
Connect to mysqli failed: 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.



------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=50939&edit=1

Reply via email to