Posts Tagged ‘pecl’

sqlite version 2.8.x and PHP 5.2.x

Thursday, August 21st, 2008

It seems straight forward if you read the PHP manual …. just do a pecl install sqlite …. but most things in live is not that simple. :( The above command gave me the following error:

../SQLite-1.0.3/sqlite.c:56: error:
‘BYREF_NONE’ undeclared here (not in a function)
../SQLite-1.0.3/sqlite.c:56: error:
‘BYREF_FORCE’ undeclared here (not in a function)
../SQLite-1.0.3/sqlite.c:125: warning:
initialization from incompatible pointer type
../SQLite-1.0.3/sqlite.c:126: warning:
initialization from incompatible pointer type
make: *** [sqlite.lo] Error 1
ERROR: `make’ failed

Thanks to a post I found on phpbuilder.com, I can post the solution below:

PHP 5 is compiled with “–without sqlite”.

Start with installing php-pecl-sqlite

$ pear download sqlite
OR
$ wget -q http://pecl.php.net/get/SQLite-1.0.3.tgz

then unpacked and began to compile it

$ tar zxvf SQLite-1.0.3.tgz
$ cd SQLite-1.0.3
$ phpize
$ ./configure
$ make

make failed here with some offset error

edit sqlite.c, comment out the following line:
/* static unsigned char arg3_force_ref[] = {3, BYREF_NONE, BYREF_NONE, BYREF_FORCE }; */

And then change these lines

function_entry sqlite_functions[] = {
PHP_FE(sqlite_open, arg3_force_ref)
PHP_FE(sqlite_popen, arg3_force_ref)
to:
function_entry sqlite_functions[] = {
PHP_FE(sqlite_open, third_arg_force_ref)
PHP_FE(sqlite_popen, third_arg_force_ref)

$ make
$ make install
$ service httpd restart