Home > Database > Mysql Tutorial > How to Fix the 'Could Not Find Driver' Error in Laravel on Ubuntu 14.04 with PHP 7.0?

How to Fix the 'Could Not Find Driver' Error in Laravel on Ubuntu 14.04 with PHP 7.0?

Susan Sarandon
Release: 2024-11-14 17:30:02
Original
918 people have browsed it

How to Fix the

Could Not Find Driver Error in Laravel on Ubuntu 14.04 with PHP 7.0

Problem:

When running php artisan migrate in a Laravel 5.4 application, the following error is encountered:

[Illuminate\Database\QueryException]
could not find driver (SQL: select * from information_schema.tables where table_schema = pmaramaldb and table_name = migrations)

[PDOException]
could not find driver
Copy after login

Investigation:

Initial troubleshooting steps, including checking PDO extension status, installing php7.0-mysql, and trying composer dump-autoload, have not resolved the issue.

Solution:

The error is likely related to a missing dependency. To resolve it, check that php7-mysql is installed. Run the following command:

sudo apt install php7.0-mysql
Copy after login

If you prefer to install the latest version of the package, use this command:

sudo apt install php-mysql
Copy after login

Restart the Apache service afterwards. This should rectify the "could not find driver" error and allow migrations to run successfully.

The above is the detailed content of How to Fix the 'Could Not Find Driver' Error in Laravel on Ubuntu 14.04 with PHP 7.0?. For more information, please follow other related articles on the PHP Chinese website!

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template