|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2010-02-05 16:59 UTC] johannes@php.net
[2010-02-06 01:10 UTC] jpmasseria at yahoo dot com
[2010-02-06 01:16 UTC] felipe@php.net
[2010-02-06 01:54 UTC] jpmasseria at yahoo dot com
[2010-02-06 01:57 UTC] jpmasseria at yahoo dot com
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Dec 03 15:00:01 2025 UTC |
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.