From:             jpmasseria at yahoo dot com
Operating system: Windows Vista
PHP version:      5.3.1
PHP Bug Type:     MySQL related
Bug description:  php_mysql.dll can't connect to "localhost" (::1) on Windows 
Vista

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 bug report at http://bugs.php.net/?id=50939&edit=1
-- 
Try a snapshot (PHP 5.2):            
http://bugs.php.net/fix.php?id=50939&r=trysnapshot52
Try a snapshot (PHP 5.3):            
http://bugs.php.net/fix.php?id=50939&r=trysnapshot53
Try a snapshot (PHP 6.0):            
http://bugs.php.net/fix.php?id=50939&r=trysnapshot60
Fixed in SVN:                        
http://bugs.php.net/fix.php?id=50939&r=fixed
Fixed in SVN and need be documented: 
http://bugs.php.net/fix.php?id=50939&r=needdocs
Fixed in release:                    
http://bugs.php.net/fix.php?id=50939&r=alreadyfixed
Need backtrace:                      
http://bugs.php.net/fix.php?id=50939&r=needtrace
Need Reproduce Script:               
http://bugs.php.net/fix.php?id=50939&r=needscript
Try newer version:                   
http://bugs.php.net/fix.php?id=50939&r=oldversion
Not developer issue:                 
http://bugs.php.net/fix.php?id=50939&r=support
Expected behavior:                   
http://bugs.php.net/fix.php?id=50939&r=notwrong
Not enough info:                     
http://bugs.php.net/fix.php?id=50939&r=notenoughinfo
Submitted twice:                     
http://bugs.php.net/fix.php?id=50939&r=submittedtwice
register_globals:                    
http://bugs.php.net/fix.php?id=50939&r=globals
PHP 4 support discontinued:          http://bugs.php.net/fix.php?id=50939&r=php4
Daylight Savings:                    http://bugs.php.net/fix.php?id=50939&r=dst
IIS Stability:                       
http://bugs.php.net/fix.php?id=50939&r=isapi
Install GNU Sed:                     
http://bugs.php.net/fix.php?id=50939&r=gnused
Floating point limitations:          
http://bugs.php.net/fix.php?id=50939&r=float
No Zend Extensions:                  
http://bugs.php.net/fix.php?id=50939&r=nozend
MySQL Configuration Error:           
http://bugs.php.net/fix.php?id=50939&r=mysqlcfg

Reply via email to