Isuru
Isuru

Reputation: 3958

could not find driver error in Laravel 5.5 for PostgreSQL

I have started developing with Laravel 5.5 and the app is hosted on Heroku. And I use the development server (php artisan serve) to run the application. But I get the following error when I try to do anything that interacts with the database. The database is hosted on Heroku. If I push all the files to Heroku and try the same thing, it works.

enter image description here

Is there a way to solve this problem in local machine? What does it mean by "could not find driver"?

Upvotes: 0

Views: 3359

Answers (2)

Jorge Chavarriaga
Jorge Chavarriaga

Reputation: 1

all I did to solve the error was run this command in the root folder of the project

composer require doctrine / dbal

How did it come to this? I followed this tutorial and verified that the problem was not with mamp https://documentation.mamp.info/en/MAMP-PRO-Mac/How-Tos/MySQL/Install-PostgreSQL/ so check that the error was in the project and not in the local server

the problem was the following

Undefined type 'Doctrine \\ DBAL \\ Driver \\ PDOConnection

the problem was in

 C: \ MAMP \ htdocs \ project \ vendor \ laravel \ framework \ src \ Illuminate \ Database \ Connectors \ Connector.php

Upvotes: 0

Gabriel Nadai
Gabriel Nadai

Reputation: 21

You need install PDO extension for pgsql. If your distro is ubuntu, try:

sudo apt install php-pgsql 

or

sudo apt-get install php7.0-pgsql 

or

sudo apt install php5-pgsql

and restart your artisan server.

Upvotes: 2

Related Questions