PHP 5.2.6 is creating SQLite 2.1 data files, which are unreadable by SQLite 3

Ryan Schmidt ryandesign at macports.org
Wed Jul 16 22:47:50 PDT 2008


On Jul 17, 2008, at 00:11, Bill Hernandez wrote:

> $ sudo port variants php5 | grep sqlite
> ---> sqlite: build sqlite support
>
> $ sudo port installed | grep sqlite
> ---> php5 @5.2.6_1+apache2+fastcgi+ipc+macosx+mysql5+pcntl+pear
> +postgresql83+readline+sockets+sqlite+tidy (active)
> ---> sqlite3 @3.5.9_0 (active)
>
> $ php --version
> ---> PHP 5.2.6 (cli) (built: Jul  7 2008 15:05:26)
> ---> Copyright (c) 1997-2008 The PHP Group
> ---> Zend Engine v2.2.0, Copyright (c) 1998-2008 Zend Technologies
> --->     with Zend Debugger v5.2.12, Copyright (c) 1999-2007, by Zend
> Technologies
>
>
> When using SQLite Data Browser 1.3,  I noticed that data files created
> with PHP 5.2.6 generate the following error :
> An error occurred: File is not a SQLite 3 database
>
> When I open the SQLite data file created in the example below with
> BBEdit, I noticed that PHP 5.2.6 is creating SQLite data files that
> contain :
> ** This file contains an SQLite 2.1 database **
>
> When I try to open a SQLite 3 data file with PHP 5.2.6, the following
> error occurs:
> Debug Warning: sqlite_demo.php line 25 - sqlite_open() [<a
> href='function.sqlite-open'>function.sqlite-open</a>]: file is
> encrypted or is not a database

As far as I know, that behavior is correct. That's just the way php  
5.2 is written.

 From the comments for the sqlite variant in the php5 portfile:

# note that standard sqlite support uses the built-in sqlite2 libraries
# while pdo sqlite support uses the sqlite3 libraries from the  
sqlite3 port

If you want php to create sqlite 3 files, you should use the pdo  
sqlite functions.



More information about the macports-users mailing list