Home > Database > Mysql Tutorial > Laravel 5.4 on PHP 7.0: Why Am I Getting a 'Could Not Find Driver (MySQL)' PDO Exception?

Laravel 5.4 on PHP 7.0: Why Am I Getting a 'Could Not Find Driver (MySQL)' PDO Exception?

DDD
Release: 2024-11-14 17:01:02
Original
829 people have browsed it

Laravel 5.4 on PHP 7.0: Why Am I Getting a

Laravel 5.4 on PHP 7.0: Resolving "Could not find driver (MySQL)" PDO Exception

Issue Overview

When attempting to migrate a database using Laravel 5.4 on Ubuntu 14.04 with Plesk 12.5.30 and PHP 7.0, 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

Troubleshooting

The following solutions have been attempted without success:

  • Enabling PDO Extension:

    • PDO is already enabled.
  • Installing php7.0-mysql:

    • PHP 7.0-mysql is already installed.
  • Installing php5-sqlite:

    • PHP 5.5-sqlite is already installed.
  • Running composer dump-autoload:

    • Has no effect.

Alternative Solution

Ensure that php7-mysql is installed. Run the following command:

sudo apt install php7.0-mysql
Copy after login

If Automatic Installation is Preferred:

sudo apt install php-mysql
Copy after login

This should resolve the "could not find driver (MySQL)" PDO exception in Laravel 5.4 with PHP 7.0.

The above is the detailed content of Laravel 5.4 on PHP 7.0: Why Am I Getting a 'Could Not Find Driver (MySQL)' PDO Exception?. 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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template