Error: file is encrypted or is not a database Error: file is encrypted or is not a database sqlite sqlite

Error: file is encrypted or is not a database


This is a version mismatch issue.

To open a database using PHP5 and SQLite we need to use a PDO and not the sqlite_open() function. An example of how to open or create a database:

try {    /*** connect to SQLite database ***/    $dbh = new PDO("sqlite:VPN0.sqlite");    echo "Handle has been created ...... <br><br>";}catch(PDOException $e){    echo $e->getMessage();    echo "<br><br>Database -- NOT -- loaded successfully .. ";    die( "<br><br>Query Closed !!! $error");}echo "Database loaded successfully ....";


I faced the same problem, use pdo instead of sqlite_open()

this link is very helpful and here is my code snippet, works perfectly, hope it helps

$dir = 'sqlite:YourPath/DBName.db';$dbh  = new PDO($dir) or die("cannot open the database");$query =  "SELECT * from dummy_table";foreach ($dbh->query($query) as $row){    echo $row[0];}


this is most likely an version mismatch between the php sqlite version and your standalone sqlite executable.

see this: http://us3.php.net/manual/en/book.sqlite.php - under "user contributed notes", from Andrew Paul Dickey.

for a quick solution you can install and use the sqlite2 standalone executable.