0

I am getting could not find driver for postgre database in lumen 5.6. But when I try this in my core php it's working.

And this is my .env configuration data for postgre database:-

  DB_CONNECTION=pgsql
  DB_HOST=localhost
  DB_PORT=5432
  DB_DATABASE=test
  DB_USERNAME=xxxx
  DB_PASSWORD=xxxxxx

And this is my bootstrap.php

    <?php

    require_once __DIR__.'/../vendor/autoload.php';

    try {
        (new Dotenv\Dotenv(__DIR__.'/../'))->load();
    } catch (Dotenv\Exception\InvalidPathException $e) {
        //
    }

    $app = new Laravel\Lumen\Application(
        realpath(__DIR__.'/../')
    );


    $app->singleton(
        Illuminate\Contracts\Debug\ExceptionHandler::class,
        App\Exceptions\Handler::class
    );

    $app->singleton(
        Illuminate\Contracts\Console\Kernel::class,
        App\Console\Kernel::class
    );

    $app->router->group([
        'namespace' => 'App\Http\Controllers',
    ], function ($router) {
        require __DIR__.'/../routes/web.php';
    });

    return $app;

I have used the same configuration tried in the laravel 5.6 and it works there.

Sivabalan
  • 971
  • 2
  • 18
  • 43
  • please show us your `bootstrap/app.php` file. – Parth Pandya May 17 '18 at 10:30
  • @parthu_panther Added the app.php file content – Sivabalan May 17 '18 at 10:38
  • ya because laravel has configuration files in which driver configurations are declared but in lumen you need to enable it first. – Parth Pandya May 17 '18 at 10:44
  • @parthu_panther i am new to both laravel and lumen. So can i tell me or give some link about how to enable driver configurations? – Sivabalan May 17 '18 at 10:48
  • change `DB_HOST=localhost` to `DB_HOST=127.0.0.1` and see if it connects or not. – Parth Pandya May 17 '18 at 11:00
  • Still the same error only – Sivabalan May 17 '18 at 11:05
  • I suggest first of all you go through the [laravel](https://laravel.com/docs/5.6) documentation. After that a quick go through [lumen](https://lumen.laravel.com/docs/5.6) documentation as most of lumen things comes from laravel. Afterwards have a look at [this](https://stackoverflow.com/questions/37215265/lumen-create-database-connection-at-runtime) answer. – Parth Pandya May 17 '18 at 11:07
  • Still i am getting the same error only – Sivabalan May 17 '18 at 11:19
  • have you tried the answer linked in previous comment? if so and still the error remains same than lets hope some expert answers it. wait for 2 days and if still the problem persists than do apply a bounty to attract expert users. – Parth Pandya May 17 '18 at 11:34
  • Yes i applied that also and still got the error. – Sivabalan May 17 '18 at 11:53

0 Answers0