問題描述
MySQL-server 和 PHP5-MySQLi 版本是否必須匹配才能進行連接?我目前收到以下錯誤:我正在運行 BSD.致命錯誤:未捕獲異?!甈DOException’,消息‘找不到驅動程序’..."
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'..."
這是連接信息:
$info = "mysql:dbname=myDB;host=localhost";
$user = "dbUser";
$pw = "somePW";
return(new PDO($info, $user, $pw));
這是我的 MySQL 信息:
Here is my MySQL information:
mysql-server-5.5.24
mysql-server-5.5.24
php5-mysqli-5.4.3
php5-mysqli-5.4.3
推薦答案
PDO 使用特定于數據庫的 驅動程序 連接到數據庫系統.您似乎缺少連接到 MySQL 數據庫所需的 pdo_mysql 驅動程序.pdo_mysql 手冊頁面上有一些關于安裝驅動程序的詳細信息,或者可能有一個 BSD 包可以使用(恐怕我對 BSD 不夠熟悉,無法提供具體建議).
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).
這篇關于PHP PDO 異常:找不到驅動程序的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!