FreeBSD的。 nginx,php-fpm,PDO_mysql驱动程序不起作用

时间:2014-12-24 19:01:45

标签: mysql nginx pdo php

php-fpm上的PDO驱动程序问题,在FreeBSD上使用nginx

参见php modules:

#php -m
[PHP Modules]
...
mysql
mysqli
mysqlnd
openssl
pcre
PDO
pdo_mysql <-is here 0_o
pdo_sqlite
Phar
posix
Reflection
session
SimpleXML
SPL
sqlite3
...

[Zend Modules]

启用PDO:     #php --ri pdo

PDO

PDO support => enabled
PDO drivers => mysql, sqlite

PHP FPM信息

# php-fpm -i
...
PDO

PDO support => enabled
PDO drivers => mysql, sqlite

pdo_mysql

PDO Driver for MySQL => enabled
Client API version => mysqlnd 5.0.10 - 20111026 - $Id: c85105d7c6f7d70d609bb4c000257868a40840ab $

Directive => Local Value => Master Value
pdo_mysql.default_socket => /tmp/mysql.sock => /tmp/mysql.sock

pdo_sqlite

PDO Driver for SQLite 3.x => enabled
SQLite Library => 3.8.7.2
...

我接受了这个错误:

2014/12/24 21:46:17 [error] 99501#0: *3930 FastCGI sent in stderr: "PHP message: PHP Fatal error:  Uncaught exception 'PDOException' with message 'could not find driver
' in /usr/home/anmall/bitmachinegewerh/client/lib/user/profile.php:22
Stack trace:
#0 /usr/home/anmall/bitmachinegewerh/client/lib/user/profile.php(22): PDO->__construct('mysql:host=loca...', '***', '****', Array)
#1 /usr/home/anmall/bitmachinegewerh/client/public/awesome.php(10): User->connectDB()
#2 {main}
  thrown in /usr/home/anmall/bitmachinegewerh/client/lib/user/profile.php on line 22" while reading response header from upstream, client: 46.48.252.89, server: bitmach
inegewerh.su, request: "POST /client/public/awesome.php HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "bitmachinegewerh.su", referrer: "http://bitmachinegewerh
.su/client/public/login.php"

最后我在phpinfo();

中看不到PDO_Mysql驱动程序

2 个答案:

答案 0 :(得分:0)

我使用Archlinux并遇到了同样的问题。

我通过重新启动php-fpm服务修复了它。

答案 1 :(得分:0)

我可能是mysql的套接字问题,如果是这样的话 1: 从终端登录到mysql并尝试找到套接字的位置
mysql -u root -p

并运行此查询以找出
2:
show variables like '%socket%';

现在你应该在mysql的socket上更改php.ini的设置 通过
找到你有效的php.ini 3:
php --ini

并添加或编辑步骤3中找到的php.ini文件 4:
pdo_mysql.default_socket=<THE PATH IN STEP 2>


感谢你 https://forum.phalconphp.com/discussion/4448/error-sqlstatehy000-2002-no-such-file-or-directory