PDO - Uncaught Exception 'Pdoexception' with message 'could not find driver'

Asked

Viewed 1,487 times

1

Look at us!

I am trying to set up a project in a Mac Yosemite environment. The project I intend to run works normally on an Ubuntu. I did the installation of the PDO drive. phpinfo is like this:

PDO

PDO support => enabled 

PDO drivers => mysql, odbc, sqlite, pgsql 


pdo_mysql 

PDO Driver for MySQL => enabled 

Client API version => mysqlnd 5.0.11-dev - 20120503 - $Id: 15d5c781cfcad91193dceae1d2cdd127674ddb3e $ 

Directive => Local Value => Master Value 

pdo_mysql.default_socket => /tmp/mysql.sock => /tmp/mysql.sock 


PDO_ODBC 

PDO Driver for ODBC (unixODBC) => enabled 

ODBC Connection Pooling => Enabled, strict matching 



pdo_pgsql 

PDO Driver for PostgreSQL => enabled 

PostgreSQL(libpq) Version => 9.4.4 

Module version => 1.0.2 

Revision =>  $Id: af568c8ae63693bc2b766337bd4731078e62f9b4 $  


pdo_sqlite 

PDO Driver for SQLite 3.x => enabled 

SQLite Library => 3.8.10.2

My Doctrine.global.php looks like this:

return array(
    'doctrine' => array(
        'connection' => array(
            'orm_default' => array(
                'driverClass' => 'Doctrine\DBAL\Driver\PDOPgSql\Driver',
                'params' => array(
                    'host'     => 'localhost',
                    'port'     => '5432',
                    'user'     => 'USER_POSTGRES',
                    'password' => 'USER_PASSWORD',
                    'dbname'   => 'my_database',
                )
            )
        )
    ),
);

But every time I run the project I have the error:

PHP Fatal error:  Uncaught exception 'PDOException' with message 'could not find driver' in PASTA_DO_MEU_PROJETO/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php:43
Stack trace:
#0 PASTA_DO_MEU_PROJETO/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php(43): PDO->__construct('pgsql:host=loca...', 'postgres', 'postgres', Array)
#1 PASTA_DO_MEU_PROJETO/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOPgSql/Driver.php(46): Doctrine\DBAL\Driver\PDOConnection->__construct('pgsql:host=loca...', 'postgres', 'postgres', Array)
#2 PASTA_DO_MEU_PROJETO/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(360): Doctrine\DBAL\Driver\PDOPgSql\Driver->connect(Array, 'postgres', 'postgres', Array)
#3 PASTA_DO_MEU_PROJETO/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(429): Doctrine\DBAL\Connection->connect()
#4 PASTA_DO_MEU_PROJETO/vendor/doctrine/ in PASTA_DO_MEU_PROJETO/vendor/zendframework/zendframework/library/Zend/ServiceManager/ServiceManager.php on line 912

Someone could help me?

  • You need to install the pdo_pgsql driver via line and command

  • I did that. He’s already skill in php.ini. So much so that in phpinfo() he already appears. But for some reason Doctrine is not recognizing.

  • You can make a simple example with PDO/pgsql working?

  • Always the same mistake.

  • Digital php -m in the console and also tries to locate the line pdo_mysql.

  • There are pdo_mysql and pdo_pgsql lines

  • Do you know if there is only one version of PHP installed on your machine? You have already restarted the web server after enabling pdo_pgsql?

Show 2 more comments
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.