gpt4 book ai didi

php - PDO异常 “could not find driver”

转载 作者:行者123 更新时间:2023-11-29 15:37:00 24 4
gpt4 key购买 nike

我刚刚安装了带有 Apache、MySQL 和 PHP 的 Debian Lenny,但收到 PDOException 无法找到驱动程序

这是它所引用的特定代码行:

$dbh = new PDO('mysql:host=' .DB_HOST . ';dbname=' .DB_NAME, DB_USER, DB_PASS)

DB_HOSTDB_NAMEDB_USERDB_PASS 是我定义的常量。它在生产服务器(以及我之前的 Ubuntu 服务器设置)上运行良好。

这与我的 PHP 安装有关吗?

网上搜索没有帮助,我得到的只是专家交流和示例,但没有解决方案。

最佳答案

您需要有一个名为 pdo_mysql 的模块。在 phpinfo() 中寻找以下内容,

pdo_mysql

PDO Driver for MySQL, client library version => 5.1.44

关于php - PDO异常 “could not find driver”,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58139157/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com