Reputation: 5550
I am using an Ubuntu 20.04 EC2 instance with php7.4/NGINX and Laravel 8.4 point to a PostgreSQL RDS instance (no public access) in AWS.
When I try to migrate (php artisan migrate
) I am getting the following error:
Illuminate\Database\QueryException
could not find driver (SQL: select * from information_schema.tables where table_schema = xxxxx-db-prod and table_name = migrations and table_type = 'BASE TABLE')
Similar questions in SO is point in how to install or enable the PostgreSQL drive. But I have already it installed and enabled.
Running php -i
this is what I get:
pdo_pgsql
PDO Driver for PostgreSQL => enabled
PostgreSQL(libpq) Version => 12.2 (Ubuntu 12.2-4)
pgsql
PostgreSQL Support => enabled
PostgreSQL(libpq) Version => 12.2 (Ubuntu 12.2-4)
PostgreSQL(libpq) => PostgreSQL 12.2 (Ubuntu 12.2-4) on x86_64-pc-linux-gnu, compiled by gcc (Ubuntu 9.3.0-8ubuntu1) 9.3.0, 64-bit
Multibyte character support => enabled
SSL support => enabled
Active Persistent Links => 0
Active Links => 0
Directive => Local Value => Master Value
pgsql.allow_persistent => On => On
pgsql.auto_reset_persistent => Off => Off
pgsql.ignore_notice => Off => Off
pgsql.log_notice => Off => Off
pgsql.max_links => Unlimited => Unlimited
pgsql.max_persistent => Unlimited => Unlimited
Running php -m
this is what I get:
...
pcntl
pcre
PDO
pdo_pgsql
pgsql
Phar
...
I have tested the same instance point to a local PostgreSQL instance, inside the same Ubuntu 20.04 EC2 instance and it works. It seems that this is not a Laravel issue. Seems to be something related to the RDS-PostgreSQL connection.
Does someone have any clue related to this issue?
Update
I notice that the origin of the issue was the DB_CONNECTION
value. I forgot to change mysql
to pgsql
in the .env
file:
DB_CONNECTION=pgsql
Upvotes: 2
Views: 1112
Reputation: 744
I had exactly the same problem, after restarting the ec2 instance everything worked.
¯_(ツ)_/¯
Upvotes: 2