Home  >  Article  >  Database  >  Why Am I Getting "Could not find driver" Exception in Laravel 5.4 on PHP 7.0?

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

Susan Sarandon
Susan SarandonOriginal
2024-11-16 12:08:03205browse

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)

[PDOException]

could not find driver

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

SQL Lite Install Solution:

Try installing SQLite by running:

sudo apt-get install php5-sqlite

Composer Dump-autoload Solution:

Run the following command:

composer dump-autoload

Resolution:

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

sudo apt install php7.0-mysql

Alternatively, install the latest version of php-mysql:

sudo apt install php-mysql

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!

Statement:
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