-1

I try to set up the Postgres with my Laravel app, but it gives me an error. I use PHP 8.1 NB: I already edit my php.ini file.

 Illuminate\Database\QueryException 

  could not find driver (Connection: pgsql, SQL: select * from information_schema.tables where table_catalog = phptest and table_schema = public and table_name = migrations and table_type = 'BASE TABLE')

  at vendor/laravel/framework/src/Illuminate/Database/Connection.php:795
    791▕         // If an exception occurs when attempting to run a query, we'll format the error
    792▕         // message to include the bindings with SQL, which will make this exception a
    793▕         // lot more helpful to the developer instead of just the database's errors.
    794▕         catch (Exception $e) {
  ➜ 795▕             throw new QueryException(
    796▕                 $this->getName(), $query, $this->prepareBindings($bindings), $e
    797▕             );
    798▕         }
    799▕     }
matiaslauriti
  • 7,065
  • 4
  • 31
  • 43

1 Answers1

4

Please check package pdo_pgsql is installed or not for php8.1 in your machine if not then installed. I hope this will be helpful to you.

For Linux :

1 . sudo apt-get install php[v]-pgsql

2 . check you php.ini file and enable this extention

enter image description here

3 . Restart you server

Tejas Prajapati
  • 115
  • 1
  • 6
Parth_009
  • 61
  • 5