1

Can anyone help me to fix this problem please the error is database [postgres] not configured.

here is my .env file :

   DB_CONNECTION=postgres
   DB_HOST=localhost
   DB_PORT=5432
   DB_DATABASE=referentiel
   DB_USERNAME=postgres
   DB_PASSWORD=postgres

and here is my database.php:

  'default' => 'postgres',

    'pgsql' => [
        'driver' => 'pgsql',
        'host' => env('DB_HOST', '127.0.0.1'),
        'port' => env('DB_PORT', '5432'),
        'database' => 'referentiel',
        'username' => env('postgres', ''),
        'password' => env('postgres', ''),
        'charset' => 'utf8',
        'prefix' => '',
        'schema' => 'public',
        'sslmode' => 'prefer',
    ],

3 Answers 3

3

Change the default parameter in your config to match the name of your postgres connection - pgsql in your case:

'default' => 'pgsql',

And put correct database parameters in your .env file.

Sign up to request clarification or add additional context in comments.

3 Comments

it's settled but i got an other error "could not find driver" do you have any idea ?
Does your server actually have the postgres extension enabled in your php.ini?
Like patricksweeney said, you probably need to install the drivers for your PHP version this should get you on the right track, but I've never used it myself and can't help you with that part.
2

Try to edit your .env

From: DB_CONNECTION=postgres

To: DB_CONNECTION=pgsql

3 Comments

try to change 'default' => 'pgsql` as @devk mentioned
if that's not working try to exec command : php artisan config:cache
This commend is profoundly useful in case you are dealing with multi-containered application.
0

i think the problem in php.ini if you use xampp open app xampp > config > php.ini

find ;extension=php_pdo_pgsql.dll ;extension=php_pdo_sqlite.dll

delete ;

change extension=php_pdo_pgsql.dll extension=php_pdo_sqlite.dll

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.