【问题标题】:'PDOException' with message 'could not find driver' (Centos, PHP 5.6)带有消息“找不到驱动程序”的“PDOException”(Centos,PHP 5.6)
【发布时间】:2016-12-28 19:04:40
【问题描述】:

错误:

致命错误:在 /test2.php:6 中未捕获异常 'PDOException' 并带有消息 'could not find driver' 堆栈跟踪:#0 /test2.php(6): PDO->__construct('sqlite3:/var/ ww...') #1 {main} 在第 6 行的 /test2.php 中抛出

第 6 行

 $db = new PDO('sqlite3:' . $dir . '/db.sqlite');

Centos 7

PHP 5.6(可以在 ISP-manager 5 中更改版本,但不适用于所有版本)

怎么办?谢谢。

【问题讨论】:

  • 首先,检查存在哪些驱动程序:print_r(PDO::getAvailableDrivers());.
  • @KIKOSoftware 数组 ([0] => mysql [1] => sqlite)

标签: php pdo sqlite centos


【解决方案1】:

试试

sudo yum install php56-pdo sqlite

或许

sudo yum install php-sqlite

我不太确定(我目前没有 CentOS 服务器来测试它)但我是从这些答案中获取的 [1][2]

【讨论】:

  • 名为 php56 的包 - 未找到 PDO。 SQLite 包 - 3.7.17-8.el7.x86_64 已经安装,并且是最新版本。什么都不做
  • 你试过第二个吗?尝试安装php-sqlite
  • 也没有找到。也许需要另一个回购?
猜你喜欢
  • 1970-01-01
  • 2012-04-22
  • 2015-03-12
  • 2020-01-21
  • 2014-01-23
  • 2016-08-30
  • 2014-05-01
  • 1970-01-01
  • 2016-07-30
相关资源
最近更新 更多