How to configure SQLite3 for PHP 5.6.14 on Apache 2.4 (Windows 7)?

I am on Windows 7 using PHP version 5.6.14 on Apache 2.4 and I am trying to access a SQLite3 database.

I get....

Fatal error : SQLite3 class not found

Here you are simple PHP code ...

<?php
  $db = new SQLite3('phpdb');

  if ($db) {
    $db->query("CREATE TABLE dogbreeds (Name VARCHAR(255), MaxAge INT);");
    $db->query("INSERT INTO dogbreeds VALUES ('Doberman', 15)");
    $result = $db->query("SELECT Name FROM dogbreeds");
    var_dump($result->fetchArray(SQLITE3_ASSOC));
  } else {
    print "Connection to database failed!\n";
  }
?>

I just searched for information about this and based on this, at the moment I have this configuration in the php.ini file ...

extension=php_pdo_sqlite.dll
extension=php_sqlite3.dll
sqlite3.extension_dir = "D:\Cesare\Lavoro\Utili\Php\5-6-14\ext"

Any suggestions? Thank you very much in advance ....

Cesare

+4
source share
2 answers

php, ";" "; extension = php_sqlite3.dll" php.ini. , ?

`extension=php_pdo_sqlite.dll` AND `extension=php_sqlite3.dll`. 

$db = sqlite_open("/absolute/path/my_sqlite.db");

 $db = new SQLiteDatabase('filename')) 

http://php.net/manual/en/book.sqlite.php

+1

, , "extension_dir",

extension_dir = "C:/php/php7.0/ext"

extension=php_pdo_sqlite.dll
extension=php_sqlite3.dll
sqlite3.extension_dir = "C:/php/php7.0/ext"
+1

Source: https://habr.com/ru/post/1617625/


All Articles