php - MYSQL_ATTR_INIT_COMMAND error -
i'm new zend framework , i'm learning how create application following steps in framework.zend webpages.
i have problem global.php page.
my global.php is:
return array( 'db' => array( 'driver' => 'pdo', 'dsn' => 'mysql:dbname=zf2tutorial;host=127.0.0.1;charset=utf8', 'driver_options' => array( pdo::mysql_attr_init_command => "set names 'utf8'" ), ), 'service_manager' => array( 'factories' => array( 'zend\db\adapter\adapter' => 'zend\db\adapter\adapterservicefactory', ), ), );
i'd know instruction pdo::mysql_attr_init_command => "set names 'utf8'"
for, because gives me error if run application on localhost:8080.
this error: fatal error: undefined class constant 'mysql_attr_init_command' in c:\devbox\zfproject\config\autoload\global.php
can remove line? , if cannot remove how can fix problem?
i'm on windows , works if remove line don't think it's right solution.
yes, can remove line.
actually, it's sort of gospel, or mantra, each php user recites without knowing meaning. it's intended set default charset, set in dsn (although effective since php 5.3.6)
nevertheless, can perpend class name backslash solve problem, make pdo class accessible within namespace.
Comments
Post a Comment