简体   繁体   English

为什么在尝试在cmd中运行主义命令时出现错误[PdoException]找不到驱动程序?

[英]Why I get error [PdoException] Couldn't find driver when trying to run doctrine commands in cmd?

When I am trying to run command: 当我尝试运行命令时:

vendor\bin\doctrine-module orm:validate-schema

in windows command line I am getting this response: 在Windows命令行中,我得到以下响应:

[Mapping]  OK - The mapping files are correct.

  [PDOException]
  could not find driver

orm:validate-schema

Why I get error [PDOException] could not find driver ? 为什么我得到错误[PDOException] could not find driver

I have extension=php_pdo_mysql.dll uncommented in PHP config. 我在PHP配置中extension=php_pdo_mysql.dll注释注释的extension=php_pdo_mysql.dll I checked if pdo enabled in php config — it is enabled. 我检查了是否在php配置中启用了pdo -它已启用。 config/autoload/doctrine.local.php file contents: config/autoload/doctrine.local.php文件内容:

<?php
return array(
    'doctrine' => array(
        'connection' => array(
            'orm_default' => array(
                'driverClass' =>'Doctrine\DBAL\Driver\PDOMySql\Driver',
                'params' => array(
                    'host'     => 'localhost',
                    'port'     => '3306',
                    'user'     => 'root',
                    'password' => '',
                    'dbname'   => 'ZF2_Test',
                )
            )
        ),
    ),
);
  • I want to say, that I have module ZfcUser and ZfcUserDoctrineORM which is needed to connect DoctrineORM module and ZfcUser module and it is working fine. 我想说的是,我有模块ZfcUserZfcUserDoctrineORM ,这是连接DoctrineORM模块和ZfcUser模块所需的,并且工作正常。

So what can cause this error message and error? 那么什么会导致此错误消息和错误呢?

Thanks. 谢谢。

PS: I am using Windows 8.1, PHP 5.3.27, OpenServer 4.9.0 PS:我正在使用Windows 8.1,PHP 5.3.27,OpenServer 4.9.0

I was getting this problem, because when I have been running php ... from command line it have been using different php.ini file. 我遇到了这个问题,因为当我从命令行运行php ... ,它一直在使用其他php.ini文件。 I found this by running this in command line: 我是通过在命令行中运行此命令找到的:

php --ini

I get knowledge, that file is different, uncommented string: 我知道,该文件是不同的,未注释的字符串:

extension=php_pdo_mysql.dll

Tried command 尝试过的命令

vendor\bin\doctrine-module orm:validate-schema

again and now everything is fine: 再一次,现在一切都很好:

罚款!!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 尝试连接到 Azure SQL 服务器时,出现 PDOException 找不到驱动程序 - When trying to connect to a Azure SQL server i get a PDOException could not find driver PDOException无法在Zend Framework 2 + Doctrine上找到驱动程序 - PDOException could not find driver on Zend Framework 2 + Doctrine 尝试使用Doctrine创建数据库时,为什么会出现PDOException? - Why do I get a PDOException when I try to create the database using Doctrine? 为什么我不能用 PDOException 捕获错误? - Why can't I catch the error with PDOException? Laravel:错误[PDOException]:在PostgreSQL中找不到驱动程序? - Laravel: Error [PDOException]: Could not Find Driver in PostgreSQL? Laravel:错误[PDOException]:在MySQL中找不到驱动程序 - Laravel: Error [PDOException]: Could not Find Driver in MySQL Laravel:错误 [PDOException]:在 PostgreSQL 中找不到驱动程序 - Laravel: Error [PDOException]: Could not Find Driver in PostgreSQL Laravel:错误[PDOException]:找不到驱动程序(PostgreSQL) - Laravel: Error [PDOException]: Could not Find Driver (PostgreSQL) 更新作曲家时出现PdoException,找不到驱动程序 - PdoException when Updating composer, could not find driver PDOException:使用 phpunit 时找不到驱动程序 - PDOException: could not find driver when using phpunit
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM