简体   繁体   中英

Laravel - xampp could not find driver (SQL: select * from sqlite_master where type = 'table' and name = migrations)

I'm using Laravel 8 and **Xampp (v3.2.4) - ** and configured phpunit.xml to run the tests on sqlite_testing (memory).

<server name="DB_CONNECTION" value="sqlite_testing"/>
<server name="DB_DATABASE" value=":memory:"/>

database.php
'sqlite_testing' => [
  'driver' => 'sqlite',
  'database' => ':memory:'
],

when i run./vendor/bin/phpunit --color --testdox i'm getting this error:

  • Illuminate\Database\QueryException: could not find driver (SQL: select * from sqlite_master where type = 'table' and name = migrations)

In order to solve this, i've tried:

  • on php.ini uncomment extension=pdo_sqlite , extension=sqlite3 and fill the sqlite3.extension_dir = "C:\xampp\php\ext"
  • copied c:\xampp\php\ext\libsqlite3.dll to C:\xampp\apache\bin
  • php artisan config:clear (after updating database.php)
  • composer update
  • composer require doctrine/dbal
  • checked php -m for PDO

Nothing worked. Still getting the error message:

   ├ Illuminate\Database\QueryException: could not find driver (SQL: select * from sqlite_master where type = 'table' and name = migrations)

Follow that steps.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM