I’m encountering an issue with my Laravel application where it’s unable to connect to the PostgreSQL database, throwing the error “IlluminateDatabaseQueryException: could not find driver”. Here are the details of my setup and the steps I’ve taken:
When attempting to run migrations or interact with the database in my Laravel application, I’m getting the following error:
php artisan migrate
` IlluminateDatabaseQueryException
could not find driver (Connection: pgsql, SQL: select * from information_schema.tables where table_catalog = tradewithshine and table_schema = public and table_name = migrations and table_type = ‘BASE TABLE’)
at vendor/laravel/framework/src/Illuminate/Database/Connection.php:801
797▕ $this->getName(), $query, $this->prepareBindings($bindings), $e
798▕ );
799▕ }
800▕
➜ 801▕ throw new QueryException(
802▕ $this->getName(), $query, $this->prepareBindings($bindings), $e
803▕ );
804▕ }
805▕ }
+35 vendor frames
36 artisan:38
IlluminateFoundationConsoleKernel::handle()`
I’m using a Linux server environment.
OS: Ubuntu 22.04
Server Panel: aaPanel
already installed php-pgsql
extension using apt-get install php-pgsql