0
votes

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 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.

1
When doing php -m you should see both PDO and pdo_mysql. Since the last one is the adapter. If pdo_mysql isn't listed then the extension is not correctly activated. It's that easy :)netiul
@netiul How I should activate extension correctly? There is no manual to install driver, it should be install by default on my server as i understand.Vladimir Gusev

1 Answers

2
votes

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!