|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #49518 can't open encrypted sqlite3 database
Submitted: 2009-09-10 08:15 UTC Modified: 2009-09-11 01:50 UTC
From: wjzhhr at gmail dot com Assigned:
Status: Not a bug Package: SQLite related
PHP Version: 5.3.0 OS: windwos xp
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: wjzhhr at gmail dot com
New email:
PHP Version: OS:


 [2009-09-10 08:15 UTC] wjzhhr at gmail dot com
can't open encrypted database which created by  wxSQLite.

   $db = new SQLite3('x.db',SQLITE3_OPEN_READONLY,"1");
   $db->exec("PRAGMA KEY='1'");
   $result = $db->query('SELECT * FROM xxx');

Warning: SQLite3::query(): Unable to prepare statement: 26, file is encrypted or is not a database 

Reproduce code:
From manual page:

Expected result:
my table: CREATE TABLE xxx(iswho text,itimes int);
two records.
Expected result:
array(4) {
  string(6) "liming"
  string(6) "liming"

Actual result:
Warning: SQLite3::query(): Unable to prepare statement: 26, file is encrypted or is not a database 


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2009-09-10 09:58 UTC]
Does it work when you supply the right encryption key as the third parameter?

SQLite3::__construct  ( string $filename  [, int $flags  [, string $encryption_key  ]] )
 [2009-09-10 13:12 UTC]
Pretty sure wxSQLite is SQLite2 and you need wxSQLite3.
 [2009-09-11 00:45 UTC] wjzhhr at gmail dot com
I use wxsqlite3-1.9.5 to create sqlite3 database, and the key is 1.

if I use sqlite3shell.exe open "x.db",the result will right.

I never use sqlite2,always use sqlite3.
 [2009-09-11 01:50 UTC]
wxsqlite3 contains a custom encryption layer that isn't part of the standard SQLite3 library which PHP includes.
 [2011-02-22 11:29 UTC] pbrun dot pro at gmail dot com
How create a SQLite database can open by php ?

i use :
$db = new SQLite3('test2.sqlite',SQLITE3_OPEN_CREATE,'test');
But the SQLite database create is not encrypted.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Apr 21 20:01:32 2024 UTC