简体   繁体   中英

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:

[Mapping]  OK - The mapping files are correct.

  [PDOException]
  could not find driver

orm:validate-schema

Why I get error [PDOException] could not find driver ?

I have extension=php_pdo_mysql.dll uncommented in PHP config. I checked if pdo enabled in php config — it is enabled. config/autoload/doctrine.local.php file contents:

<?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.

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

I was getting this problem, because when I have been running php ... from command line it have been using different php.ini file. 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:

罚款!!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM