Felicity
Felicity

Reputation: 151

php artisan migrate not working when trying to set up sqlite database

I have just cloned a laravel project I was working on, into a new machine. I have re-installed all the dependencies, including sqlite and re-configured the database details in the .env file. However, when I try to run php artisan migrate, I get the following error:

 Illuminate\Database\QueryException 

  could not find driver (SQL: PRAGMA foreign_keys = ON;)

  at C:\xampp\htdocs\Soko\vendor\laravel\framework\src\Illuminate\Database\Connection.php:759
    755▕         // If an exception occurs when attempting to run a query, we'll format the error
    756▕         // message to include the bindings with SQL, which will make this exception a
    757▕         // lot more helpful to the developer instead of just the database's errors.
    758▕         catch (Exception $e) {
  ➜ 759▕             throw new QueryException(
    760▕                 $query, $this->prepareBindings($bindings), $e
    761▕             );
    762▕         }
    763▕     }

  1   C:\xampp\htdocs\Soko\vendor\laravel\framework\src\Illuminate\Database\Connectors\Connector.php:70
      PDOException::("could not find driver")

  2   C:\xampp\htdocs\Soko\vendor\laravel\framework\src\Illuminate\Database\Connectors\Connector.php:70
      PDO::__construct()

What could be the problem?

Here is my .env file

LOG_CHANNEL=stack
LOG_DEPRECATIONS_CHANNEL=null
LOG_LEVEL=debug

DB_CONNECTION=sqlite

BROADCAST_DRIVER=log

I had already come across a similar question. And I have tried going to my php.ini file, there are two apparently, one for development and the other for production. I have edited them both, by removing the semicolon in (;extension=pdo_sqlite.dll) and (;extension=sqlite3). I have also tried to tab them out, but as per the comments, nothing has worked.

Upvotes: 0

Views: 1287

Answers (1)

Hosserin Ibrahim
Hosserin Ibrahim

Reputation: 224

  1. check file .env exist and the same name.
  2. check in .env file database name and configuration exist.
  3. check database exist in SQLite.
  4. check command php artisan return all Laravel commands, if doesn't work execute composer i.
  5. then check the error: could not find driver (SQL: PRAGMA foreign_keys = ON;).

Upvotes: 1

Related Questions