php - Laravel - xampp 找不到驱动程序(SQL:select * from sqlite_master where type = 'table' and name = migrations)
问题描述
我正在使用Laravel 8和 **Xampp (v3.2.4) - ** 并配置 phpunit.xml 以在 sqlite_testing (内存)上运行测试。
<server name="DB_CONNECTION" value="sqlite_testing"/>
<server name="DB_DATABASE" value=":memory:"/>
database.php
'sqlite_testing' => [
'driver' => 'sqlite',
'database' => ':memory:'
],
当我运行 ./vendor/bin/phpunit --color --testdox 我收到此错误:
- Illuminate\Database\QueryException: 找不到驱动程序 (SQL: select * from sqlite_master where type = 'table' and name = migrations)
为了解决这个问题,我尝试过:
- 在 php.ini 上取消注释extension=pdo_sqlite,extension=sqlite3并填写sqlite3.extension_dir = "C:\xampp\php\ext"
- 将 c:\xampp\php\ext\libsqlite3.dll 复制到 C:\xampp\apache\bin
- php artisan config:clear (更新 database.php 后)
- 作曲家更新
- 作曲家需要学说/dbal
- 检查 php -m 的 PDO
没有任何效果。仍然收到错误消息:
├ Illuminate\Database\QueryException: could not find driver (SQL: select * from sqlite_master where type = 'table' and name = migrations)
解决方案
按照这些步骤。
1 step: sudo apt install sqlite3
2 step: sudo apt-get install php7.4-sqlite3 -y
3 step: php -m | grep sqlite
4 step: .env
DB_CONNECTION=sqlite
DB_DATABASE={absolute_path}/database.sqlite
#DB_FOREIGN_KEYS=true
#DB_HOST=127.0.0.1
#DB_PORT=3306
#DB_DATABASE=homestead
#DB_USERNAME=homestead
#DB_PASSWORD=secret
推荐阅读
- c# - 如何在 C# 中显示 MySQL “PRINT” 命令的输出?
- javascript - 是否可以将代理对象绑定到 ES6 类构造函数?
- excel - 在 Excel 多项选择中复制粘贴值
- division - 输入接近 0 时 Newton-Raphson Division 算法的初始值
- html - 逐渐为 SVG 设置动画
- asp.net-core - 使用 Blazor wasm Bearer Token 进行 SignalR 身份验证
- kotlin - Spring Cloud Gateway:后过滤 Web 客户端请求
- c# - 在c#中将对象模型转换为json?
- php - Laravel - 在选项卡式窗格中动态加载内容
- python-3.x - Beam Pubsub 代码被击中并且没有发布消息