Sunday, March 12, 2017

Laravel: PHP Artisan Migrate throws PDO Exception: Could not find driver (Postgres)

OS: Ubuntu 16.10

Server: Nginx

DB: PostgreSQL 9.5.4

Laravel 5.4

Trying to perform my database migrations, but php artisan migrate throws the following error:

[Illuminate\Database\QueryException] could not find driver: (SQL select * from information_schema.tables where tables_schema = username and table_name = migrations)

Followed by a second message stating

[PDOException] could not find driver

I have done the following:

  1. Verified that I have php-pgsql's latest version installed
  2. Uncommented the line pertaining to php_pdo_pgsql.dll in /etc/php/7.0/fpm/php.ini
  3. Restarted both posgtresql and nginx multiple times

Currently, when I run php -i, the output I get for the PDO section is

PDO support => enabled PDO drivers => pgsql

The pdo_pgsql section yields

PostgreSQL(libpq) Version =>9.5.4 Module version =>7.0.15-0ubuntu0.16.10.4

And the pgsql section returns

PostgreSQL(libpq) Version = 9.5.4 PostgreSQL(libpq) => PostgreSQL 9.5.4 on x86_64-pc-linux-gnu, compiled by gcc (Ubuntu 6.1.1-11ubuntu12) 6.1.1 20160805, 64-bit Multibyte character support => enabled SSL support => enabled Active Persistent Links => 0 Active Links => 0

But in spite of this, still getting the same error. I thought there was some chance it might be a permissions problem, but running the command as either root or www-data has the same result.



via user968270

Advertisement