简体   繁体   中英

PDOException could not find driver on Zend Framework 2 + Doctrine

I'm trying to install Zend Framework 2 + Doctrine from this manual and have some problem with PDO driver. Doctrine is trying to connect to my MySQL server and then trying to create schema:

./vendor/bin/doctrine-module orm:schema-tool:create

I have this error:

 [PDOException]
 could not find driver

This is my config/autoload/doctrine.local.php:

 return array(   'doctrine' => array(
     'connection' => array(
       'orm_default' => array(
         'driverClass' =>'Doctrine\DBAL\Driver\PDOMySql\Driver',
         'params' => array(
           'driver'   => 'pdo_mysql', 
           'host'     => 'localhost',
           'port'     => '3306',
           'user'     => 'root',
           'password' => 'password',
           'dbname'   => 'blog', 
 )))));

I have PHP 5.3.5 and i have uncommented ;extension=php_pdo_mysql.dll in php.ini, also it wasn't commented. But php -m | grep -i pdo php -m | grep -i pdo gives me:

PDO

only. I'm know that it should be pdo_mysql too, but i'm trying everything and it isn't appear.

Anyway, PDO driver is works well at my another project on this server, where I'm not using Zend and Doctrine.

Ohh yes. I'm just solved a problem. I'm going to this page and thought to find my php.ini files anywhere else perhaps PHP folder - it was one more in "C:\\Users\\%username%\\AppData\\Local\\VirtualStore\\Program Files (x86)\\wamp\\bin\\php\\php5.3.5" and there row

;extension=php_pdo_mysql.dll

weren't uncomment. I'm uncommented it and it works!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM