[英]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',
)
)
),
),
);
ZfcUser
and ZfcUserDoctrineORM
which is needed to connect DoctrineORM
module and ZfcUser
module and it is working fine. ZfcUser
和ZfcUserDoctrineORM
,这是连接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.