0

I'm using ZendServer 6.2.0 php 5.4 and apache2

I'm trying to configure doctrine by following this tutorial and when I run that command: ./vendor/bin/doctrine-module orm:validate-schema I get an error:

Undefined class constant 'MYSQL_ATTR_INIT_COMMAND' in var/www/CommunicationApp/config/autoload/global.php on line 19

I already uncomment the extension=php_pdo_mysql.dll in /usr/local/zend/etc/php.ini

And I tried to install the php5-mysql, but it replaces the zendserver.

<?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',
  ),
  ),
 );
John
  • 107
  • 1
  • 3
  • 15
  • 1
    Seems there is a bug: http://stackoverflow.com/questions/2424343/undefined-class-constant-mysql-attr-init-command-with-pdo – James Dec 13 '13 at 02:59
  • I did everything they said, I can't solve this – John Dec 13 '13 at 03:20
  • You tried using "1002" instead of the constant? – James Dec 13 '13 at 03:39
  • When I use 1002 and run the command: ./vendor/bin/doctrine-module orm:validate-schema I get: [Doctrine\Common\Persistence\Mapping\MappingException] File mapping drivers must have a valid directory path, however the given pa th [/var/www/CommunicationApp/module/CsnFileManager/config/../src/CsnFileMa nager/Entity] seems to be incorrect! – John Dec 13 '13 at 03:53
  • When you use PDO php trying get class from current namespace. Try to point on root namespace: \PDO::MYSQL_ATTR_INIT_COMMAND – Microbe Sep 03 '14 at 11:27

0 Answers0