FreeBSD.nginx、php-fpm PDO_mysql驱动程序不起作用


FreeBSD. nginx, php-fpm, PDO_mysql driver does not work

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

问题

请参阅 php 模块:

#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驱动程序;

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

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

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

并运行此查询以找出答案
阿拉伯数字:

show variables like '%socket%';

现在你应该在MySQL的套接字
上更改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