We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

Odd issue with PostgreSQL, model generation works (with dev tools) but usage gives "could not find driver"

Subject pretty much says it. I can use dev tools to connect and generate a model, but when I try to call ModelType::findFirst() in a controller, it just gives "driver not found" with no other output. Not sure if I bonked the build, this is my first time using it. Here's my config:

return new \Phalcon\Config(array(
    'database' => array(
        'adapter'     => 'Postgresql',
        'host'        => 'dbsrv',
        'username'    => 'xxx',
        'password'    => 'xxx',
        'dbname'      => 'xxx',
    ),
    'application' => array(
        'controllersDir' => __DIR__ . '/../../app/controllers/',
        'modelsDir'      => __DIR__ . '/../../app/models/',
        'viewsDir'       => __DIR__ . '/../../app/views/',
        'pluginsDir'     => __DIR__ . '/../../app/plugins/',
        'libraryDir'     => __DIR__ . '/../../app/library/',
        'cacheDir'       => __DIR__ . '/../../app/cache/',
        'baseUri'        => '/',
    )
));

And here's PHPINFO output for selected modules:

https://gist.github.com/joelclark/3dff083fefe91cc52e35

Any pointers on tracking down the issue?

EDIT: Installed MySQL php drivers and now getting this:

SQLSTATE[HY000] [2003] Can't connect to MySQL server on 'dbsrv' (4)

I believe I am onto something here.



655
Accepted
answer

Okay, the problem was at the top of the file, I didn't realize the skeleton did this:

use Phalcon\Db\Adapter\Pdo\Mysql as DbAdapter;