9951 explained code solutions for 126 technologies


sqliteHow to configure SQLite with XAMPP on Windows?


  1. Install XAMPP from Apache Friends website.
  2. Download SQLite from SQLite Download Page.
  3. Extract the downloaded file in C:\xampp\php\ext directory.
  4. Open php.ini file in C:\xampp\php directory and add the following line at the end of the file extension=php_sqlite3.dll
  5. Restart XAMPP.
  6. Test the installation by running the following code in C:\xampp\htdocs
<?php
$db = new SQLite3('test.db');
$db->exec('CREATE TABLE foo (bar STRING)');
$db->exec("INSERT INTO foo (bar) VALUES ('This is a test')");
$result = $db->query('SELECT bar FROM foo');
var_dump($result->fetchArray());
?>

Output example

array(1) {
  [0]=>
  string(14) "This is a test"
}
  1. Finally, you can access the SQLite database through the XAMPP server.

Edit this code on GitHub