Sqlite installed and updated.
- Download source package. You can get it from here: http://pecl.php.net/package/SQLite
# wget http://pecl.php.net/get/SQLite-1.0.3.tgz
or
# pear download sqlite
If publication host has x86_64 architecture it is suggested to use source files from here http://cvs.php.net/viewvc.cgi/pecl/sqlite/?pathrev=PHP_5_2 and make sure that SQLite library has version 2.8.17 or upper.
- Unpack SQLite-1.0.3.tgz to SQLite-1.0.3 directory:
# tar -xzf SQLite-1.0.3.tgz
- Move into SQLite-1.0.3 directory
# cd SQLite-1.0.3
- You need to have UTF-8 encoding support for sqlite.so extension, so following modification should be done:
edit SQLite-1.0.3/libsqlite/src/main.c file and change this section
#ifdef SQLITE_UTF8
const char sqlite_encoding[] = “UTF-8″;
#else
const char sqlite_encoding[] = “iso8859″;
#endif
to
//#ifdef SQLITE_UTF8
const char sqlite_encoding[] = “UTF-8″;
//#else
//const char sqlite_encoding[] = “iso8859″;
//#endif
comment all strings excluding one with UTF-8 encoding.
- Find phpize binary file and run it. Location for this file can be different. Standard path is /usr/bin/phpize. Make sure that you are still in SQLite-1.0.3 directory and run the following command:
# /usr/bin/phpize (path to phpize can be different)
If there is no such file, try to find it with following commands:
# whereis phpize
# locate phpize|grep bin
- Find location for php-config file. It should be the same as for phpize file and run following commands:
# ./configure –with-sqlite –with-php-config=/usr/bin/php-config (path to php-config can be different)
- Run ‘make’ command:
# make
If you meet something like that:
“error: `BYREF_NONE’ undeclared”
you will need 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
- # cp modules/sqlite.so /usr/lib/php/modules (path to modules folder can be different). Actually, ‘make install’ should copy the extension to appropriate place so this operation might be not required.
- You should create a file in /etc/php.d/ named sqlite.ini or add sqlite.so extension directly into php.ini file. Inside write this :
; Enable sqlite extension module
extension=sqlite.so
- Restart apache service with
# /sbin/service/httpd restart
or
# /etc/init.d/httpd restart
Recent Comments