Zend Server Mysql Socket problem with PDO [Solved]

Hold on Cowboy

This blog post is pretty old. Be careful with the information you find in here. It's likely dead, dying, or wildly inaccurate.

The Problem 

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.

The Best Solution 

It’s as simple as specifying in replace of localhost. I guess if you do this, you force PDO to use a TCP connection.

Solution Alternative 

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.

Resources: http://forums.zend.com/viewtopic.php?f=44&t=568

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]