xampp v3.2.4 enabling sqlite3 (WINDOWS 10) 64bit

I've setup xampp on my windows machine, and I'm trying to use the sqlite3 module with php 7.4.3

I've edited my php.ini file and adjusted the extension=sqlite3 and restarted the service. When i try and run this:

<?php
$db = new SQLite3('test.db');
?>

I get this error:

Fatal error: Uncaught Error: Class 'SQLite3' not found

I've also tried using pdo:

$db = new PDO("sqlite:".__DIR__."/test.db");

And with that i get this error instead:

Fatal error: Uncaught PDOException: could not find driver

Now I'm sure i have the sqlite3 ext because when i check the php/ext folder i can see the php_sqlite3.dll I haven't changed anything else in the php.ini regarding the dir for the ext but im sure it's all setup correctly since all the other extensions are working just fine. Maybe I'm just being ignorant and I'm using sqlite3 incorrectly so please if someone knows the problem enlighten me.


Solution 1:

  1. Go in your XAMPP\php\php.ini, modify it with a text editor

  2. Search for ;extension=sqlite3 with CTRL + F

  3. Remove the ; to uncomment the line

  4. Restart Apache to apply change

Now you are able to use Sqlite3 on XAMPP for Windows :D

Solution 2:

libsqlite3.dll isn't installed in the xampp\apache\bin folder. you have to go into xampp\php copy libsqlite3.dll and paste into xampp\apache\bin. easy fix, not sure why it isn't installed there in the first place ¯_( ͡° ͜ʖ ͡°)_/¯

Solution 3:

Uncomment extension=sqlite3 in php.ini:

;extension=sqlite3

=>

extension=sqlite3

and restart Apache.