Symfony2的。无法加载pdo驱动程序

时间:2013-08-09 19:18:14

标签: php symfony windows-7 pdo x86

当我尝试使用

创建数据库时
doctrine:database:create

有错误(mysql或postgresql):

Could not create database for connection named `symfony`
could not find driver

my parametrs.yml:

parameters:
database_driver: pdo_mysql
database_host: 127.0.0.1
database_port: 3306
database_name: symfony
database_user: root
database_password: null
mailer_transport: smtp
mailer_host: 127.0.0.1
mailer_user: null
mailer_password: null
locale: en
secret: 1dffcb10ddfc2bbc4f211d773f2524557
database_path: null

当我尝试将我的类映射到db

php app/console doctrine:generate:entities Demos/BlogBundle/Entity/Post
php app/console doctrine:schema:update --force

有错误:

[PDOException]         
  could not find drive

在php.ini文件中取消注释

extension=php_pdo_mysql.dll
extension=php_pdo_pgsql.dll

print_r(get_loaded_extensions())结果:

数组(... mbstring [35] => exif [36] => gd [37] => gettext [38] => mysql [39] => Phar [40] => pdo_mysql [41] => pdo_pgsql [42] => pgsql ...)

我发现http://www.php.net/manual/en/pdo.installation.php 用户gerrywastaken写道,可能需要命令:

- with-pdo-mysql [= DIR] PDO:MySQL支持。 DIR是MySQL的基础                                  如果mysqlnd作为DIR传递,则MySQL本机                                  将使用本机驱动程序[/ usr / local]

我无法理解执行此命令的位置,或配置...

1 个答案:

答案 0 :(得分:0)

您需要在php.ini配置中取消注释以下行后重新启动Web服务器