【发布时间】:2013-12-12 19:40:41
【问题描述】:
我正在尝试按照this 教程配置原则,当我运行该命令时: ./vendor/bin/doctrine-module orm:validate-schema 我得到一个错误:
第 19 行 var/www/CommunicationApp/config/autoload/global.php 中未定义的类常量“MYSQL_ATTR_INIT_COMMAND”
这里是 global.php 文件:
<?php
/**
* Global Configuration Override
*
* You can use this file for overriding configuration values from modules, etc.
* You would place values in here that are agnostic to the environment and not
* sensitive to security.
*
* @NOTE: In practice, this file will typically be INCLUDED in your source
* control, so do not include passwords or other sensitive information in this
* file.
*/
return array(
'db' => array(
'driver' => 'Pdo',
'dsn' => 'mysql:dbname=zf2tutorial;host=localhost',
'driver_options' => array(
PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES \'UTF8\''
),
),
'service_manager' => array(
'factories' => array(
'Zend\Db\Adapter\Adapter'
=> 'Zend\Db\Adapter\AdapterServiceFactory',
),
),
);
我已经取消了 /usr/local/zend/etc/php.ini 中的 extension=php_pdo_mysql.dll 的注释
【问题讨论】:
-
尝试将其命名空间到“根”命名空间:
\PDO::MYSQL_ATTR_INIT_COMMAND(PDO 之前的反斜杠) -
它不起作用,同样的错误
标签: php mysql zend-framework doctrine-orm zend-framework2