“没有这样的文件或目录”使用 PHPUnit 和 XAMPP 时出现 SQLSTATE 错误Zend框架
我收到的错误如下。
Zend_Db_Adapter_Exception: SQLSTATE[HY000] [2002] No such file or directory
我尝试将 xampp php 设置为我的 PATH 中的 php,希望它是一个配置文件,但我没有运气。我不太确定为什么它会说没有这样的文件或目录。有人有什么想法吗?
更新: 我还查看了正在调用的 php.ini 文件(取自 php -i),并将默认套接字设置为等于 XAMPP 的 mysql.sock 文件,但仍然出现相同的错误。
The error I'm getting is below.
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
那很有趣。我必须将以下条目添加到 MySQL 的选项数组中。
我通过进入 Zend/Db/Adapter/Pdo/Abstract.php 并让它 print_r 发现它(这很丑)。从那里,我发现它正在尝试连接到 /tmp/mysql.sock (有人知道为什么吗?)
That was fun. I had to add the following entry into the options array from MySQL.
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?)