V
V
Vlad Sharikov2014-05-09 19:06:06
Doctrine ORM
Vlad Sharikov, 2014-05-09 19:06:06

Why does [PDOException] Could not find driver occur? ZF2/DoctrineORM?

Hello
I'm trying to run this command from the root of the zf2 project:
vendor\bin\doctrine-module orm:validate-schema
The result of the command is:

[Mapping]  OK - The mapping files are correct.
  [PDOException]
  could not find driver
orm:validate-schema

I did a search, but I didn't find anything useful.
There were such options as problems with the config file. Here is my config:
<?php
return array(
    'doctrine' => array(
        'connection' => array(
            'orm_default' => array(
                'driverClass' =>'Doctrine\DBAL\Driver\PDOMySql\Driver',
                'params' => array(
                    'host'     => 'localhost',
                    'port'     => '3306',
                    'user'     => 'root',
                    'password' => '',
                    'dbname'   => 'ZF2_Test',
                )
            )
        ),
    ),
);

All the way + there is another module that works with ORM Doctrine and it works without any problems.
There were options with an unconnected extension extension=php_pdo_mysql.dllin the php.ini file. I have it connected in Php.ini + phpinfo() shows that PDO is enabled.
In the end, I did not find a solution to this problem. What can cause this error and how to solve it?
Thanks

Answer the question

In order to leave comments, you need to log in

4 answer(s)
S
Sergey, 2014-05-10
Protko @Fesor

Most likely you did not connect the module for the cli environment (although this is strange), it has its own php.ini. Check just in case.

Y
yvm, 2014-07-15
@yvm

I'm not sure, but maybe it's the letter i ) (mysqli)

I
ILYA, 2016-06-01
@iliacmd

I will describe what helped me with this error.
My situation: I need php-fpm, ubuntu 10 is installed, there is no php5-fpm in apt repositories (in 14 there is, but there is 5.5.9, which is also not ice), there is an option to add a third-party repository, but I decided to collect from the sources. Ended up with a similar problem with pdo -could not find driver . (There is a suspicion that something was not configured correctly during the build.) A banal installation from apt-get php5-mysql helped .

U
uaSaint, 2014-09-19
@uaSaint

As far as I understand there is no solution?

PDO support => enabled
PDO drivers => mysql, pgsql, sqlite
PDO Driver for MySQL => enabled
PDO Driver for PostgreSQL => enabled
PDO Driver for SQLite 3.x => enabled

'driver' => 'PDO',
error from zf2 - could not find driver.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question