PHP Velho Oeste 2024

Kurulum

PHP 5'ten itibaren bu eklenti öntanımlı olarak etkin ve kullanılabilir durumda olup istenirse kolayca kaldırılabilir.

Dikkat

Bu eklentinin PECL sürümünü artık bakımı yapılmadığından kullanmayın. Paylaşımlı bile derleyecek olsanız daima PHP paketiyle gelen eklentiyi kullanın. Kaynak dosyaları pakette php-src-dir/ext/sqlite dizininde olup derlemek için phpize yöntemi kullanılabilir.

Windows kullanıcılarının bu eklentiyi kullanabilmesi için php.ini içinde php_sqlite.dll'i etkin kılmaları gerekir.

Windows derlemelerinde ayrıca PDO da etkindir. Bunun sebebi PHP 5.1.0'ın bu eklentiye bağımlı olmasıdır. Dolayısıyla php.ini dosyanızda şu satırlar bulunmalıdır:

extension=php_pdo.dll
extension=php_sqlite.dll
Linux ve Unix işletim sistemlerinde, PDO'yu paylaşımlı bir eklenti olarak derleyecekseniz SQLite'ı da paylaşımlı derlemelisiniz. Bunun için derleme sırasında --with-sqlite=shared yapılandırma seçeneğini kullanmanız gerekir.

PHP 5.0.x serisi Windows derlemelerinde bu eklenti öntanımlı olarak etkin olduğundan bir DLL dosyası gerekli değildir.

SQLite 3, PDO SQLite üzerinden desteklenmektedir.

Bilginize: Yetkisiz kullanıcılar için Windows kurulumu

Windows işletim sisteminde yetkisiz hesaplar öntanımlı olarak TMP ortam değişkenine sahip değildir. Bu durum, SQLite'ın geçici dosyaları windows dizininde oluşturmasına sebep olur ve bu istenmeyen bir durumdur. Bu bakımdan TMP ortam değişkenini HTTP sunucusu için veya HTTP sunucusunu çalıştıran kullanıcı için tanımlamanız gerekir. HTTP sunucusu olarak Apache kullanıyorsanız bunu httpd.conf dosyanızda SetEnv yönergesi üzerinden yapabilirsiniz. Örnek:

SetEnv TMP c:/temp
Bu ayarı sunucu seviyesinde yapamıyorsanız bunu betiğinizde de yapabilirsiniz:
putenv('TMP=C:/temp');
Burada belirttiğiniz dizin HTTP sunucusunun oluşturulan dosyaları okuyup yazabildiği bir dizin olmalıdır. Yoksa şöyle bir hata iletisi alabilirsiniz: malformed database schema - unable to open a temporary database file for storing temporary tables

add a note add a note

User Contributed Notes 3 notes

up
1
Otto Monnig omonnig [at] gmail [dot] com
13 years ago
In a CentOS 5 default installation, SQLite requires the pdo, sqlite and
pdo_sqlite extensions, which are not installed.  The previous note was very
helpful, but needed some additions:

- get your source version from the historical releases page

        http://www.php.net/releases/

- repeat the compile process below for pdo, sqlite and pdo-sqlite extensions,
  (gcc is required and may have to be installed)

    tar xvf php-your.version.here.tar.gz
    cd php-your.version.here/ext/sqlite/
    phpize
    ./configure
    make
    make install

   
- create file /etc/php.d/sqlite.ini:

    ; Enable sqlite extension module
    extension=pdo.so
    extension=sqlite.so
    extension=pdo_sqlite.so

- [restart apache] service httpd restart

- search phpinfo(); for 'sqlite' to verify correct installation\
up
1
thomas.zangerl [ at ]-NOSPAM-freenet.de
14 years ago
CentOS 5.4's and probably Fedora's php5 packages are compiled without SQLite support.

While the PECL build did not work for me (version mismatch?) it helped to get the PHP source from

http://php.net/downloads.php

and just compile the SQLite module by doing

tar xfvj php-5.2.12.tar.bz2
cd php-5.2.12/ext/sqlite/
phpize
./configure
make
make install
[restart apache]

Make sure to have php-devel/php5-dev installed and to get the PHP version matching your installed PHP from the download page.
Probably this will require a rebuild when updating the php-packages on CentOS but currently there are unfortunately no good alternatives.
up
-2
askroot at gmail dot com
15 years ago
RedHat Enterprise Linux 5 or CentOS 5 sqlite extension install

Super User - root
shell> mkdir temp
shell> cd temp
shell> wget http://pecl.php.net/get/SQLite-1.0.3.tgz
shell> tar zxvf SQLite-1.0.3.tgz
shell> cd SQLite-1.0.3

sqlite.c patch

--- sqlite.c.orig       2004-07-18 19:23:18.000000000 +0900
+++ sqlite.c    2009-04-08 01:39:40.000000000 +0900
@@ -53,7 +53,9 @@
extern int sqlite_encode_binary(const unsigned char *in, int n, unsigned char *out);
extern int sqlite_decode_binary(const unsigned char *in, unsigned char *out);

+/*
static unsigned char arg3_force_ref[] = {3, BYREF_NONE, BYREF_NONE, BYREF_FORCE };
+*/

static int le_sqlite_db, le_sqlite_result, le_sqlite_pdb;

@@ -122,8 +124,8 @@
enum { PHPSQLITE_ASSOC = 1, PHPSQLITE_NUM = 2, PHPSQLITE_BOTH = PHPSQLITE_ASSOC|PHPSQLITE_NUM };

function_entry sqlite_functions[] = {
-       PHP_FE(sqlite_open, arg3_force_ref)
-       PHP_FE(sqlite_popen, arg3_force_ref)
+       PHP_FE(sqlite_open, third_arg_force_ref)
+       PHP_FE(sqlite_popen, third_arg_force_ref)
        PHP_FE(sqlite_close, NULL)
        PHP_FE(sqlite_query, NULL)
        PHP_FE(sqlite_exec, NULL)

shell> phpize
shell> ./configure
shell> make && make install
shell> ls -l /usr/lib/php/modules/sqlite.so
-rwxr-xr-x 1 root root 871225 Apr  7 18:07 /usr/lib/php/modules/sqlite.so
shell> cd /etc/php.d
shell> vi sqlite.ini
; Enable sqlite extension module
extension=sqlite.so
:wq

Web Server Restart

phpinfo.php
<?php
phpinfo
();
?>

sqlite
SQLite support enabled
PECL Module version  1.0.3 $Id: sqlite.c,v 1.62.2.25 2004/07/10 12:25:33 wez Exp $ 
SQLite Library  2.8.14 
SQLite Encoding  iso8859 

Directive Local Value Master Value
sqlite.assoc_case 0 0
To Top