Does the MySQL-server and PHP5-MySQLi version have to match in order for a connection to be possible? I'm currently receiving the error below: I am running BSD. "Fatal error: Uncaught exception 'PDOException' with message 'could not find driver'..."
为了实现连接,MySQL-server和php5 - sqmyli版本必须匹配吗?我目前正在接收下面的错误:我正在运行BSD。“致命错误:未被捕获的异常‘PDOException’和消息‘找不到驱动程序’……”
Here is the the connection info:
以下是连接信息:
$info = "mysql:dbname=myDB;host=localhost";
$user = "dbUser";
$pw = "somePW";
return(new PDO($info, $user, $pw));
Here is my MySQL information:
下面是我的MySQL信息:
mysql-server-5.5.24
mysql-server-5.5.24
php5-mysqli-5.4.3
php5-mysqli-5.4.3
3 个解决方案
#1
3
PDO uses database specific drivers to connect to database systems. It looks like you are missing the pdo_mysql driver that is required to connect to a MySQL database. There is some details on installing the driver on the pdo_mysql manual page, or there may be a BSD package that you can use (I am afraid I'm not familiar enough with BSD to offer specific advice).
PDO使用特定于数据库的驱动程序连接数据库系统。看起来您缺少连接到MySQL数据库所需的pdo_mysql驱动程序。在pdo_mysql手册页上安装驱动程序有一些细节,或者您可以使用BSD包(恐怕我对BSD还不够熟悉,不能提供具体的建议)。
#2
16
I had this same issue on my CentOS install. I had tried to install imagick and hosed my install. When I removed all of my php files and reinstalled something wasn't working right.
我在CentOS的安装上也遇到了同样的问题。我尝试过安装imagick并使用软管安装。当我删除了所有的php文件并重新安装时,有些东西并没有正常工作。
I ran:
我跑:
yum install php-pdo
yum install php-pdo_mysql
After doing those two lines I ran
做完这两句话后,我就跑了
service httpd restart
and everything came back up and running.
一切都恢复正常了。
#3
2
Thanks to zerkms and John C for pointing me in the right direction. Below are the commands I used to install the driver:
感谢zerkms和John C为我指明了正确的方向。下面是我用来安装驱动程序的命令:
#cd /usr/ports/databases/php5-pdo_mysql
#make install clean
#apachectl restart
#1
3
PDO uses database specific drivers to connect to database systems. It looks like you are missing the pdo_mysql driver that is required to connect to a MySQL database. There is some details on installing the driver on the pdo_mysql manual page, or there may be a BSD package that you can use (I am afraid I'm not familiar enough with BSD to offer specific advice).
PDO使用特定于数据库的驱动程序连接数据库系统。看起来您缺少连接到MySQL数据库所需的pdo_mysql驱动程序。在pdo_mysql手册页上安装驱动程序有一些细节,或者您可以使用BSD包(恐怕我对BSD还不够熟悉,不能提供具体的建议)。
#2
16
I had this same issue on my CentOS install. I had tried to install imagick and hosed my install. When I removed all of my php files and reinstalled something wasn't working right.
我在CentOS的安装上也遇到了同样的问题。我尝试过安装imagick并使用软管安装。当我删除了所有的php文件并重新安装时,有些东西并没有正常工作。
I ran:
我跑:
yum install php-pdo
yum install php-pdo_mysql
After doing those two lines I ran
做完这两句话后,我就跑了
service httpd restart
and everything came back up and running.
一切都恢复正常了。
#3
2
Thanks to zerkms and John C for pointing me in the right direction. Below are the commands I used to install the driver:
感谢zerkms和John C为我指明了正确的方向。下面是我用来安装驱动程序的命令:
#cd /usr/ports/databases/php5-pdo_mysql
#make install clean
#apachectl restart