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

Limited Time Offer!

For Less Than the Cost of a Starbucks Coffee, Access All DevOpsSchool Videos on YouTube Unlimitedly.
Master DevOps, SRE, DevSecOps Skills!

Enroll Now

Error:

 local.ERROR: could not find driver (Connection: sqlite, SQL: PRAGMA foreign_keys = ON;) {"exception":"[object] (Illuminate\\Database\\QueryException(code: 0): could not find driver (Connection: sqlite, SQL: PRAGMA foreign_keys = ON;) at C:\\xampp\\htdocs\\tag-input-project\\vendor\\laravel\\framework\\src\\Illuminate\\Database\\Connection.php:825)
[stacktrace]
#0 C:\\xampp\\htdocs\\tag-input-project\\vendor\\laravel\\framework\\src\\Illuminate\\Database\\Connection.php(779): Illuminate\\Database\\Connection->runQueryCallback('PRAGMA foreign_...', Array, Object(Closure))
#1 C:\\xampp\\htdocs\\tag-input-project\\vendor\\laravel\\framework\\src\\Illuminate\\Database\\Connection.php(560): Illuminate\\Database\\Connection->run('PRAGMA foreign_...', Array, Object(Closure))
#2 C:\\xampp\\htdocs\\tag-input-project\\vendor\\laravel\\framework\\src\\Illuminate\\Database\\Schema\\Builder.php(523): Illuminate\\Database\\Connection->statement('PRAGMA foreign_...')
#3 C:\\xampp\\htdocs\\tag-input-project\\vendor\\laravel\\framework\\src\\Illuminate\\Database\\SQLiteConnection.php(59): Illuminate\\Database\\Schema\\Builder->enableForeignKeyConstraints()
#4 C:\\xampp\\htdocs\\tag-input-project\\vendor\\laravel\\framework\\src\\Illuminate\\Database\\SQLiteConnection.php(28): Illuminate\\Database\\SQLiteConnection->configureForeignKeyConstraints()
#5 C:\\xampp\\htdocs\\tag-input-project\\vendor\\laravel\\framework\\src\\Illuminate\\Database\\Connectors\\ConnectionFactory.php(277): Illuminate\\Database\\SQLiteConnection->__construct(Object(Closure), 'C:\\\\xampp\\\\htdocs...', '', Array)
#6 C:\\xampp\\htdocs\\tag-input-project\\vendor\\laravel\\framework\\src\\Illuminate\\Database\\Connectors\\ConnectionFactory.php(76): Illuminate\\Database\\Connectors\\ConnectionFactory->createConnection('sqlite', Object(Closure), 'C:\\\\xampp\\\\htdocs...', '', Array)
#7 C:\\xampp\\htdocs\\tag-input-project\\vendor\\laravel\\framework\\src\\Illuminate\\Database\\Connectors\\ConnectionFactory.php(51): Illuminate\\Database\\Connectors\\ConnectionFactory->createSingleConnection(Array)
#8 C:\\xampp\\htdocs\\tag-input-project\\vendor\\laravel\\framework\\src\\Illuminate\\Database\\DatabaseManager.php(167): Illuminate\\Database\\Connectors\\ConnectionFactory->make(Array, 'sqlite')
#9 C:\\xampp\\htdocs\\tag-input-project\\vendor\\laravel\\framework\\src\\Illuminate\\Database\\DatabaseManager.php(93): Illuminate\\Database\\DatabaseManager->makeConnection('sqlite')
#10 C:\\xampp\\htdocs\\tag-input-project\\vendor\\laravel\\framework\\src\\Illuminate\\Session\\SessionManager.php(108): Illuminate\\Database\\DatabaseManager->connection('sqlite')
#11 C:\\xampp\\htdocs\\tag-input-project\\vendor\\laravel\\framework\\src\\Illuminate\\Session\\SessionManager.php(95): Illuminate\\Session\\SessionManager->getDatabaseConnection()
#12 C:\\xampp\\htdocs\\tag-input-project\\vendor\\laravel\\framework\\src\\Illuminate\\Support\\Manager.php(106):

Solution:

The error message you’re seeing suggests that the reason your Laravel application can’t connect to the SQLite database is because your PHP environment doesn’t have the SQLite driver installed or enabled. You’ll need to activate the SQLite extension in PHP because you’re running XAMPP.

Steps to Fix the SQLite Driver Issue:

Step 1:- Locate the php.ini File:

  • Open your XAMPP installation directory (e.g., C:\xampp).
  • Find the php.ini file, which is usually located in the php folder (e.g., C:\xampp\php\php.ini).

Step 2:- Enable SQLite Extension:

  • Open the php.ini file in a text editor.
  • Look for the following lines:
;extension=pdo_sqlite
;extension=sqlite3
  • Remove the semicolon (;) at the beginning of these lines to uncomment them:
extension=pdo_sqlite
extension=sqlite3

Step 3:- Save and Restart Apache:

  • Save the changes to the php.ini file.
  • Restart Apache through the XAMPP Control Panel.
Senior Software Development Engineer at Cotocus

Related Posts

How We Fixed a Stubborn Laravel MeiliSearch Bulk Indexing Failure (16,000+ Records)

Limited Time Offer! For Less Than the Cost of a Starbucks Coffee, Access All DevOpsSchool Videos on YouTube Unlimitedly. Master DevOps, SRE, DevSecOps Skills! Enroll Now If…

Read More

Laravel Search Without Docker, Queues, or Horizon

Limited Time Offer! For Less Than the Cost of a Starbucks Coffee, Access All DevOpsSchool Videos on YouTube Unlimitedly. Master DevOps, SRE, DevSecOps Skills! Enroll Now Modern…

Read More

Laravel Scout with Typesense vs Meilisearch

Limited Time Offer! For Less Than the Cost of a Starbucks Coffee, Access All DevOpsSchool Videos on YouTube Unlimitedly. Master DevOps, SRE, DevSecOps Skills! Enroll Now Modern…

Read More

SESSION_DRIVER=file vs SESSION_DRIVER=database in Laravel

Limited Time Offer! For Less Than the Cost of a Starbucks Coffee, Access All DevOpsSchool Videos on YouTube Unlimitedly. Master DevOps, SRE, DevSecOps Skills! Enroll Now Which…

Read More

Laravel Logging: Complete Step-by-Step Guide to Enable, Debug, Verify, and Master Logs in Any Laravel Project

Limited Time Offer! For Less Than the Cost of a Starbucks Coffee, Access All DevOpsSchool Videos on YouTube Unlimitedly. Master DevOps, SRE, DevSecOps Skills! Enroll Now Logging…

Read More

Complete Tutorial: Setting Up Laravel Telescope Correctly (Windows + XAMPP + Custom Domain)

Limited Time Offer! For Less Than the Cost of a Starbucks Coffee, Access All DevOpsSchool Videos on YouTube Unlimitedly. Master DevOps, SRE, DevSecOps Skills! Enroll Now This…

Read More
Subscribe
Notify of
guest
0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments