为什么 Doctrine 说找不到 PDO 驱动程序?

2022-01-16 00:00:00 php doctrine symfony1

我今天试用了 Symfony 2,并尝试使用 Doctrine.

I tried Symfony 2 today and I tried to play a bit with Doctrine.

但是当我在命令行中使用命令 php app/console dictionary:schema:create 时,它会返回这个错误:

But when I use the command php app/console doctrine:schema:create in the command line, it returns this error:

[PDOException]
could not find driver

doctrine:schema:create [--dump-sql] [--em[="..."]]

我的 php.ini 文件和 phpinfo() 清楚地显示 PDO 驱动程序已加载.我还在纯 PHP 中创建了一个小脚本,以使用 PDO 连接到我的数据库,它运行良好.没有错误,因此 PDO 已安装好并且可以正常工作.

My php.ini file and phpinfo() cleary show that the PDO driver is loaded. I also created a little script in pure PHP to connect to my database using PDO and it worked fine. No error, so PDO is well installed and works.

PHP 和 MySQL 正在我的计算机上使用最新版本的 EasyPHP 运行.

PHP and MySQL are running on my computer using the last version of EasyPHP.

Doctrine 出了什么问题?我现在应该去哪里看?

What could have gone wrong with Doctrine? Where should I look now?

推荐答案

您需要正确配置您的 php cli,以加载与 Web 服务器版本配置加载相同的扩展.

You need to configure correctly your php cli, to load the same extensions that the web server version has configured to load.

这里有一个 链接,关于 PHP 搜索配置文件的位置

Here is a link on where PHP searches for the configuration file

相关文章