以下是我为尝试解决此问题所做的工作清单:
我在 Windows 7 上并使用 MAMP。我的 PHP 版本是 7.3.7。
我得到的完整错误是:
Illuminate\Database\QueryException : could not find driver (SQL: select * from information_schema.tables where table_schema = lol and table_name = migrations and table_type = 'BASE TABLE')
at C:\MAMP\htdocs\League Of Legends Backend\vendor\laravel\framework\src\Illuminate\Database\Connection.php:664
660| // If an exception occurs when attempting to run a query, we'll format the error
661| // message to include the bindings with SQL, which will make this exception a
662| // lot more helpful to the developer instead of just the database's errors.
663| catch (Exception $e) {
> 664| throw new QueryException(
665| $query, $this->prepareBindings($bindings), $e
666| );
667| }
668|
Exception trace:
1 Doctrine\DBAL\Driver\PDOException::("could not find driver")
C:\MAMP\htdocs\League Of Legends Backend\vendor\doctrine\dbal\lib\Doctrine\DBAL\Driver\PDOConnection.php:31
2 PDOException::("could not find driver")
C:\MAMP\htdocs\League Of Legends Backend\vendor\doctrine\dbal\lib\Doctrine\DBAL\Driver\PDOConnection.php:27
Please use the argument -v to see more details.
在服务器提供的页面之一上使用phpinfo(),以确定 PHP 版本和php.ini文件位置。我的 PHP 版本是 7.3.7,我的php.ini文件位于C:\MAMP\conf\php7.3.7\php.ini. 这 3 行在该文件中未注释:
extension=php_mysql.dll
extension=php_mysqli.dll
extension=php_pdo_mysql.dll
在服务器提供的页面之一上使用 get_loaded_extensions 以查看所有加载的扩展。
翻阅古今
天涯尽头无女友
波斯汪
回首忆惘然