1

prior to asking, I have checked several (not all) the answers to similar questions in SO.

My current settings are Windows 10, running Laragon (if you don't know what Laragon is, I highly recommend it), that comes with Apache 2, Postgres 11, PHP, etc. Everything is configured correctly.

If I write a plain PHP app, the connection to the database works perfectly, I can connect (pg_connect()) make queries pg_query() and such, so the PHP pgsql and pdo_pgsql are working correctly, yet I got this error:

1   Doctrine\DBAL\Driver\PDOException::("could not find driver")
D:\...\vendor\doctrine\dbal\lib\Doctrine\DBAL\Driver\PDOConnection.php:31

2   PDOException::("could not find driver")
D:\...\vendor\doctrine\dbal\lib\Doctrine\DBAL\Driver\PDOConnection.php:27

My .env file in Laravel has:

DB_CONNECTION=pgsql
DB_HOST=127.0.0.1
DB_PORT=5432
DB_DATABASE=xxxxxx
DB_USERNAME=xxxxxx
DB_PASSWORD=xxxxxx

So, what am I missing? What should I check?

@Alex No, it's not that, this is a small portion of my php.ini

...
extension=openssl
;extension=pdo_firebird
extension=pdo_mysql
;extension=pdo_oci
;extension=pdo_odbc
extension=pdo_pgsql
;extension=pdo_sqlite
extension=pgsql
;extension=shmop
...

Maybe my php configuration got corrupted? Can such thing happen?


EDIT - Solved

This is what happened: apparently, either the PHP files or one of the Postgres' DLL was corrupted. It was solved with exactly the same configuration described above as soon as I re-installed everything. Took me few hours of backup and such, but it is working now.

I got no idea how this happened. Since I was working on a development environment maybe a coworker installed or did something, I don't know.

Should I remove the question?

luisfer
  • 1,927
  • 7
  • 40
  • 54
  • 1
    The `pg_*` functions do *not* use PDO, so the fact that they're working successfully says nothing about PDO. You're most likely just missing the pdo_pgsql module. – Alex Howansky Aug 13 '19 at 17:52

0 Answers0