Edit report at http://bugs.php.net/bug.php?id=52434&edit=1
ID: 52434 Updated by: dtajchre...@php.net Reported by: anthon dot pang at gmail dot com Summary: mysqlnd: host cannot be a hostname -Status: Open +Status: Bogus Type: Bug Package: MySQL related Operating System: Ubuntu 10.04 PHP Version: 5.3.3 New Comment: Tell PHP where your mysql.sock file is via the DSN or pdo_mysql.default_socket in the php.ini file and your error will go away. Your conclusion is way off. http://www.php.net/manual/en/ref.pdo-mysql.connection.php Previous Comments: ------------------------------------------------------------------------ [2010-07-25 04:42:45] anthon dot pang at gmail dot com Description: ------------ With PDO_MYSQL, if PHP is linked with mysql client libraries (instead of mysqlnd), the DSN can contain a host parameter with a hostname, e.g., host=localhost. However, with mysqlnd, the host has to be an ip address, e.g., host=127.0.0.1. This occurs for '--with-mysqli=mysqlnd' or '--with-pdo-mysql=mysqlnd'. It appears mysqlnd wants to use a Unix socket even though the port is explictly specified, This backward incompatibility surprises users migrating from php 5.2.x and find their apps suddenly can't connect. MySQL 5.1.41 Test script: --------------- >From Zend Framework 1.10.6: $_isConnected = @mysqli_real_connect( $this->_connection, $this->_config['host'], $this->_config['username'], $this->_config['password'], $this->_config['dbname'], $port ); Expected result: ---------------- Expect it to connect. Actual result: -------------- Warning: PDO::__construct() [pdo.--construct]: [2002] No such file or directory (trying to connect via unix:///tmp/mysql.sock) in /var/www/libs/Zend/Db/Adapter/Pdo/Abstract.php on line 129 SQLSTATE[HY000] [2002] No such file or directory ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/bug.php?id=52434&edit=1