简体   繁体   English

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

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

Problems with PDO driver on php-fpm, with nginx on FreeBSD php-fpm上的PDO驱动程序问题,FreeBSD上的nginx问题

See php modules: 查看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 is enabled: # php --ri pdo 已启用PDO:#php --ri pdo

PDO

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

PHP FPM information 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
...

And i take this error: 我认为这个错误:

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"

Finally i dont see PDO_Mysql driver in phpinfo(); 最后,我在phpinfo()中看不到PDO_Mysql驱动程序;

I'm using Archlinux and ran into the same issue. 我正在使用Archlinux并遇到相同的问题。

I fixed it by restarting php-fpm service. 我通过重新启动php-fpm服务来修复它。

I might be the mysql's socket problem, if so 如果是这样,我可能是mysql的套接字问题
1: log into mysql from terminal and try to find the socket's place 1:从终端登录mysql并尝试找到套接字的位置
mysql -u root -p

and run this query to find out 并运行此查询以找出
2: 2:
show variables like '%socket%';

now you should change your php.ini's settings on mysql's socket 现在您应该在mysql的套接字上更改php.ini的设置
find your effective php.ini by 找到您有效的php.ini
3: 3:
php --ini

and add or edit php.ini file found in step 3. 并添加或编辑第3步中找到的php.ini文件。
4: 4:
pdo_mysql.default_socket=<THE PATH IN STEP 2>


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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM