简体   繁体   English

从5.2.x更新的PHP 5.3.6上的PDO错误

[英]PDO error on the updated PHP 5.3.6 from 5.2.x

Actualy my server updated PHP to 5.3.6 from 5.2.x. Actualy我的服务器从5.2.x将PHP更新到5.3.6。 After this- all my mysql connections failed. 在此之后 - 我的所有mysql连接都失败了。 I catch such PDO error Connection failed: SQLSTATE[HY000] [2002] No such file or directory Also checked in php.ini file value of the pdo_mysql.default_socket which is /tmp/mysql.sock 我抓到这样的PDO错误连接失败:SQLSTATE [HY000] [2002]没有这样的文件或目录也检查了pdo_mysql.default_socket的 php.ini文件值,即/tmp/mysql.sock

Host service told me to repair my mysql DB passwords. 主机服务告诉我修复我的mysql数据库密码。 But it didn't help. 但它没有帮助。 Can somebody help me with this issue? 有人可以帮我解决这个问题吗?

hehe, nice support ;) This has absolutely nothing to do with the passwords. 呵呵,很好的支持;)这与密码完全无关。 PDO_MySQL communicates under linux via sockets with the mysql-server. PDO_MySQL通过socket与mysql-server在linux下进行通信。 First of all find out, where is the socket now. 首先找出,套接字现在在哪里。 (Sorry, but I dont know how :X) (对不起,但我不知道如何:X)

If you have access to the php.ini , change 如果您有权访问php.ini ,请更改

pdo_mysql.default_socket = /path/to/mysql.sock

If you dont have access to it, change the the instanciation of the pdo-object like described under PDO_MySQL Connection 如果您无法访问它,请更改pdo-object的instanciation,如PDO_MySQL Connection下所述

$db = new PDO('mysql:unix_socket=/path/to/mysql.sock;dbname=testdb');

You probably must change/add some settings here. 您可能必须在此处更改/添加一些设置。

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

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