$encryption_key and all encryption features will be enabled only if the SQLite encryption module is installed. It's a proprietary, costly module. So if it's not present, supplying an encryption key will have absolutely no effect.(PHP 5 >= 5.3.0, PHP 7, PHP 8)
SQLite3::__construct — Instanziiert ein SQLite3-Objekt und öffnet eine SQLite3-Datenbank
$filename, int $flags = SQLITE3_OPEN_READWRITE | SQLITE3_OPEN_CREATE, string $encryptionKey = "")Instanziiert ein SQLite3-Objekt und öffnet eine Verbindung zu einer SQLite3-Datenbank. Wurde libsqlite3 mit Unterstützung für Verschlüsselung kompiliert, wird versucht den angegebenen Schlüssel zu nutzen.
filename
       Pfad zur SQLite-Datenbank oder :memory:, um eine im
       Speicher befindliche Datenbank zu nutzen. Ist
       filename eine leere Zeichenkette, dann wird eine
       private, temporäre Datenbank auf der Festplatte erzeugt. Diese private
       Datenbank wird automatisch gelöscht, sobald die Datenbankverbindung
       geschlossen wird.
      
flags
       Optionale Schalter, die die Art bestimmen, wie die SQLite-Datenbank
       geöffnet wird. Standardmäßig wird SQLITE3_OPEN_READWRITE |
       SQLITE3_OPEN_CREATE zum Öffnen genutzt.
       
          SQLITE3_OPEN_READONLY: Öffnet die Datenbank im
          "nur-lese"-Modus.
         
          SQLITE3_OPEN_READWRITE: Öffnet die Datenbank
          zum Lesen und Schreiben.
         
          SQLITE3_OPEN_CREATE: erzeugt die Datenbank,
          sollte diese nicht existieren.
         
encryptionKeyEine optionale Verschlüsselungs-Phrase, die zur Ver- und Entschlüsselung der Datenbank genutzt wird. Ist das SQLite-Verschlüsselungsmodul nicht installiert, dann hat dieser Parameter keine Wirkung.
Löst im Fehlerfall eine Exception aus.
| Version | Beschreibung | 
|---|---|
| 7.0.10 | Der Parameter filenamekann nun leer sein, um eine
       private, temporäre Datenbank auf der Festplatte zu verwenden. | 
Beispiel #1 SQLite3::__construct()-Beispiel
<?php
$db = new SQLite3('mysqlitedb.db');
$db->exec('CREATE TABLE foo (bar TEXT)');
$db->exec("INSERT INTO foo (bar) VALUES ('Dies ist ein Test')");
$result = $db->query('SELECT bar FROM foo');
var_dump($result->fetchArray());
?>$encryption_key and all encryption features will be enabled only if the SQLite encryption module is installed. It's a proprietary, costly module. So if it's not present, supplying an encryption key will have absolutely no effect.Note that the SQLITE3_OPEN_READONLY flag cannot be combined with the SQLITE3_OPEN_CREATE flag. If you combine both of these flags, a rather unhelpful "Unable to open database: out of memory" exception will be thrown.