Archive

Posts Tagged ‘zend framework’

Zend Server 4.0.6 + Framework 1.9 and PDO_MYSQL on Mac OS X always defaults to /temp/mysql.sock

December 8, 2009 Leave a comment

I always get an error like the one below when I first run Zend Server with a Zend Framework 1.9 app.

Fatal error: Uncaught exception ‘Zend_Db_Adapter_Exception’
with message ‘SQLSTATE[HY000] [2002] Can’t connect to local
MySQL server through socket ‘/tmp/mysql.sock’

Of course, recompiling PHP and so on might fix it, but I found, for time’s sake, it’s simpler to just to issue the command from the terminal. (You’ll need to be admin or know an admin’s password).

sudo ln -s /usr/local/zend/mysql/tmp/mysql.sock /tmp/mysql.sock

If you’re fed up of running this command every time you log in, just download Lingon and create a task that runs automatically on boot or login.