I'm trying to connect to the PostgreSQL database through laravel in order to make a php artisan migrate , but I get the error
[PDOException] could not find driver
looking at similar questions found there to enable extensions in php.ini
but did not solve my problem, still gives me the same error.
In other parts of my code I use the database and I can add records so I think my settings database right. I do not understand the error.
Database.php file:
<?php return [
'fetch' => PDO::FETCH_CLASS,
'default' => env('DB_CONNECTION', 'pgsql'),
'connections' => [
'pgsql' => [
'driver' => 'pgsql',
'host' => env('DB_HOST', 'localhost'),
'database' => env('DB_DATABASE', 'forge'),
'username' => env('DB_USERNAME', 'forge'),
'password' => env('DB_PASSWORD', ''),
'charset' => 'utf8', 'prefix' => '',
'schema' => 'public',
],
],
'migrations' => 'migrations',
]; ?>
Check if you have pdo_pgsql
extention.
You can
php -i | grep pgsql
to see it.