Illuminate\Database\QueryException could not find driver Laravel

Issue

I deploy a laravel project on an apache server on a Debian 10 machine.
The database is an MySQL deployed on another debian 10 machine on the same network.

I can go to the connection interface of the application but when I connect this error appears :

Illuminate\Database\QueryException
could not find driver (SQL: select * from `users` where `email` = [email protected] limit 1)

I have already tried these commands :

php artisan migrate
sudo apt install php-mysql
sudo apt install php7.4-mysql
sudo systemctl restart apache2
composer require doctrine/dbal
composer update

these commands work but do not solve the problem.

and I already tried to comment and uncomment this line in the php.ini :

extension=pdo_mysql

in php-m i have
PDO and pdo-mysql

and i have restart my server with :

systemctl restart apache2

after modification

Solution

I finally found the solution
infact the php version used by apache was 7.3 and not 7.4 with :

<?php phpinfo() ?>

however when I did:

php --version

the version was indeed 7.4.
I followed this tutorial to change the version
https://tecadmin.net/switch-between-multiple-php-version-on-debian/?amp
and it works

Answered By – Baptiste Coquelet

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published