- July 2010 (1)
- June 2010 (4)
- May 2010 (3)
- April 2010 (6)
- March 2010 (6)
- February 2010 (8)
- January 2010 (13)
- December 2009 (4)
- October 2009 (2)
- September 2009 (1)
PDO_Mysql error with Zend Server and socket
I've headed this issue off before, but now I think I know why it happens.
The problem
With a new install of Zend Server on my Mac and trying to access a DB with my Zend Framework web app I am greeted with an error of
Message: SQLSTATE[HY000] [2002] Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)" when trying to run our application.
This was rather frustrating as I changed all instances of mysql_default_socket in the PHP settings (php.ini). It still didn't pick up the location of the socket. Since I'm using PDO, it looks like this is an issue in PHP 5.2 for PDO.
http://forums.zend.com/viewtopic.php?f=44&t=568
The work around for me has been to declare the socket in my application.ini file
resources.db.params.unix_socket = "/usr/local/zend/mysql/tmp/mysql.sock"
The problem this introduces, haveing a different application.ini on the server and on then on my local devel machine.
Ugggg.
Comments
The solution (for me) It's
The solution (for me)
It's been kinda pesky for me too. Here's what I do in application.ini to make it ok:
Post new comment