|   | php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login | 
| 
  [2009-09-10 08:15 UTC] wjzhhr at gmail dot com
 Description:
------------
can't open encrypted database which created by  wxSQLite.
<?php
   $db = new SQLite3('x.db',SQLITE3_OPEN_READONLY,"1");
   $db->exec("PRAGMA KEY='1'");
   $result = $db->query('SELECT * FROM xxx');
   var_dump($result->fetchArray());
?>
Warning: SQLite3::query(): Unable to prepare statement: 26, file is encrypted or is not a database 
Reproduce code:
---------------
---
From manual page: sqlite3.open
---
Expected result:
----------------
my table: CREATE TABLE xxx(iswho text,itimes int);
liming|1
xiaojie|2
two records.
Expected result:
array(4) {
  [0]=>
  string(6) "liming"
  ["iswho"]=>
  string(6) "liming"
  [1]=>
  int(1)
  ["itimes"]=>
  int(1)
}
Actual result:
--------------
Warning: SQLite3::query(): Unable to prepare statement: 26, file is encrypted or is not a database 
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits             | |||||||||||||||||||||||||||
|  Copyright © 2001-2025 The PHP Group All rights reserved. | Last updated: Fri Oct 31 18:00:01 2025 UTC | 
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.