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
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
If you prefer to install the latest version of the package, use this command:
sudo apt install php-mysql
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!