- mongodb - 在 MongoDB mapreduce 中,如何展平值对象?
- javascript - 对象传播与 Object.assign
- html - 输入类型 ="submit"Vs 按钮标签它们可以互换吗?
- sql - 使用 MongoDB 而不是 MS SQL Server 的优缺点
我刚刚使用 Apache、MySQL 和 PHP 安装了 Debian Lenny,我收到 PDOException 找不到驱动程序
。
这是它所指的特定代码行:
$dbh = new PDO('mysql:host=' . DB_HOST . ';dbname=' . DB_NAME, DB_USER, DB_PASS)
DB_HOST
、DB_NAME
、DB_USER
和 DB_PASS
是我定义的常量。它在生产服务器(以及我之前的 Ubuntu 服务器设置)上运行良好。
这与我的 PHP 安装有关吗?
搜索互联网没有帮助,我得到的只是专家交流和示例,但没有解决方案。
最佳答案
您需要有一个名为 pdo_mysql 的模块。在phpinfo()中寻找关注,
pdo_mysql
PDO Driver for MySQL, client library version => 5.1.44
关于php - PDOException “could not find driver”,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2852748/
我正在使用 symfony,当我在控制台中输入以下内容时: php app/console doctrine:schema:create 我有以下错误 [Doctrine\DBAL\Exception
我在 PHP 中收到以下错误: Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[HY000] [2003]
这是我的代码: $db = new PDO('mysql:host=192.168.1.1;dbname=mydb'); 是否可以更改异常消息“无法连接到‘192.168.1.1’上的 MySQL 服
我在 PHP 中收到以下错误: Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[HY000] [2003]
我安装了 Laravel 并从 git 服务器克隆了一个存储库以在临时服务器上使用。安装所有必需的工具后,我想迁移数据库。我现在得到的错误是: [2016-05-04 16:54:51] local.
如果我无法连接到数据库(例如 xamp 关闭或数据库连接关闭等),我会 try catch 错误。我尝试使用 PDO::errorCode() 但没有产生结果。 在我的php中,我有一个connect
当我运行以下代码时,出现此错误: Fatal error: Uncaught PDOException: SQLSTATE[HY093]: Invalid parameter number: numb
我正在使用 Articles 类从我的数据库中提取关于 ..articles 的数据。我可以使用实例来插入数据、修改它,但我似乎无法从不同的页面集使用它。文件夹结构如下所示/cms/conf.php(
这个问题在这里已经有了答案: PHP Fatal error: Uncaught PDOException: could not find driver (4 个答案) PDOException “
这段代码工作正常,但我想处理 exception如果有任何问题,所以我故意在 query 中犯了一个语法错误但没有任何反应。下面是代码 try { $sql = "INSERT INTO jo
我不知道如何在下面的代码中捕获PDOException,请告诉我在下面的代码中哪里抛出异常? 我有(目录): - folder -1) b.php -2) c.php - au
我有一段简单的代码,在 PHP 中使用 PDO: $conn = new PDO('mysql:host=localhost;dbname=someDatabase', $username, $pas
我目前正在通过终端在 Laravel 中进行迁移,并且在尝试使用 php artisan migrate 时出现这两个错误;我将在下面打印错误: Exception trace: 1 PDOE
try { self::$dbinstance = new PDO( "mysql:host=$c[host];dbname=$c[dbname]", $c['user'],
我目前正在完善我的网站,一切正常但我一直收到错误。它不会破坏任何东西,但看起来很烦人。我一直在尝试很多东西,但我需要一些新的眼光来看待这个问题:/ 错误 PHP Fatal error: Cannot
获取POST传递过来的信息,将字符串中的所有空格去掉,然后启动一个新的pdo实例,连接mysql,将POST传递过来的信息插入到表中。 $title = trim($_POST["title"]);
我可以将迁移迁移到数据库,但是当我访问公用文件夹时,我收到一个 PDOException : SQLSTATE[28000] [1045] 用户“root”@“localhost”访问被拒绝(使用密码
我在 CentOS 7 上使用 PHP 5.6 运行 MariaDB。这是我的连接字符串: try { $connStr = 'mysql:host=server;dbname=mysql';
try { self::$dbinstance = new PDO( "mysql:host=$c[host];dbname=$c[dbname]", $c['user'],
所以我正在尝试为这样的 Laravel 应用程序编写单元测试: protected function setUp() { parent::setUp(); $this->disable
我是一名优秀的程序员,十分优秀!