PHP 7.0 上的 Laravel 5.4:為什麼我會收到「無法找到驅動程式 (MySQL)」PDO 異常?

DDD
發布: 2024-11-14 17:01:02
原創
746 人瀏覽過

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:

  • [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

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
登入後複製

If Automatic Installation is Preferred:

sudo apt install php-mysql
登入後複製

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

以上是PHP 7.0 上的 Laravel 5.4:為什麼我會收到「無法找到驅動程式 (MySQL)」PDO 異常?的詳細內容。更多資訊請關注PHP中文網其他相關文章!

來源:php.cn
本網站聲明
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn
熱門教學
更多>
最新下載
更多>
網站特效
網站源碼
網站素材
前端模板