"No such file or directory" SQLSTATE error using PHPUnit with XAMPP & Zend Framework
The error I'm getting is below.
开发者_JS百科Zend_Db_Adapter_Exception: SQLSTATE[HY000] [2002] No such file or directory
I've tried setting the xampp php to be the php in my PATH, hoping that it's a configuration file, but I had no luck with that. I'm not really sure why else it would say no such file or directory. Does anyone have any ideas?
Update: I also looked into the php.ini file that's being called (as taken from php -i), and set the default socket to equal XAMPP's mysql.sock file, and still the same error.
That was fun. I had to add the following entry into the options array from MySQL.
'unix_socket' => '/Applications/XAMPP/xamppfiles/var/mysql/mysql.sock',
I found it by (this is ugly) going into the Zend/Db/Adapter/Pdo/Abstract.php and having it print_r the exception. From there, I found it was trying to connect to /tmp/mysql.sock (Anyone know why?)
精彩评论