Home > Database > Mysql Tutorial > body text

Why Am I Getting 'Could not find driver' Exception in Laravel 5.4 on PHP 7.0?

Susan Sarandon
Release: 2024-11-16 12:08:03
Original
209 people have browsed it

Why Am I Getting

Laravel 5.4 on PHP 7.0: Troubleshooting "Could not find driver" Exception

Problem:

When attempting to migrate a Laravel 5.4 project on PHP 7.0 using Ubuntu 14.04, the following exceptions are encountered:

[IlluminateDatabaseQueryException]

could not find driver (SQL: select * from information_schema.tables where table_schema = pmaramaldb and table_name = migrations)
Copy after login

[PDOException]

could not find driver
Copy after login

Possible Solutions:

Enabling Extension Solution:

Check if the PDO extension is enabled.

Installing php7.0-mysql Solution:

Ensure that MySQL is installed by running:

sudo apt-get install php7.0-mysql
Copy after login

SQL Lite Install Solution:

Try installing SQLite by running:

sudo apt-get install php5-sqlite
Copy after login

Composer Dump-autoload Solution:

Run the following command:

composer dump-autoload
Copy after login

Resolution:

If the aforementioned solutions don't work, try installing php7-mysql. Execute the following command:

sudo apt install php7.0-mysql
Copy after login

Alternatively, install the latest version of php-mysql:

sudo apt install php-mysql
Copy after login

The above is the detailed content of Why Am I Getting 'Could not find driver' Exception in Laravel 5.4 on 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