This answer has eluded me for months. I have Zend Server CE installed on my Mac (and linux web servers). I would use a DSN similar to the following (please note that my real password is not ‘root’).
This would result in an error in a PHP Fatal error of
This drove me mad looking for an answer. I had not configured it to connect through a socket, why was it doing that? To add more injury to this insult, if I tried to connect to Zend Server’s mysql socket (/usr/local/zend/mysql/tmp/mysql.sock) I would still get the same error message.
It’s as simple as specifying
127.0.0.1 in replace of
localhost. I guess if you do this, you force PDO to use a TCP connection.
I haven’t tried this, but you could also symlink from
I’m not a big fan of symlinks that reach outside of the application.
It seems there is a bug in PDO PHP 5.2.x that is not fixed until 5.3.x.
Did this help you out? It took me a few days to piece together all this information together, I hope this saves you some time (who knows, maybe the future me will be thankful I wrote this down). Let me know your thoughts. [email protected]