PHP install sqlite3 extension

2

Estamos usando o PHP 5.3.6 aqui, mas usamos o comando --without-sqlite3 ao compilar o PHP. (Está na coluna 'Configurar comando'). Mas é muito arriscado recompilar o PHP nesse servidor; há muitos visitantes. Como podemos instalar / usar o sqlite3?

Atenciosamente, Kevin

[EDITAR]

yum repolist dá:

Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirror.nl.leaseweb.net
 * extras: mirror.nl.leaseweb.net
 * updates: mirror.nl.leaseweb.net
repo id                        repo name                                  status
base                           CentOS-5 - Base                            3,566
extras                         CentOS-5 - Extras                            237
updates                        CentOS-5 - Updates                           376
repolist: 4,179

rpm -qa | grep php dá:

php-pdo-5.3.6-1.w5
php-mysql-5.3.6-1.w5
psa-php5-configurator-1.5.3-cos5.build95101022.10
php-mbstring-5.3.6-1.w5
php-imap-5.3.6-1.w5
php-cli-5.3.6-1.w5
php-gd-5.3.6-1.w5
php-5.3.6-1.w5
php-common-5.3.6-1.w5
php-xml-5.3.6-1.w5

php -i | grep sqlite dá:

PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib64/php/modules/sqlite3.so' - /usr/lib64/php/modules/sqlite3.so: cannot open shared object file: No such file or directory in Unknown on line 0
Configure Command =>  './configure'  '--build=x86_64-redhat-linux-gnu' '--host=x86_64-redhat-linux-gnu' '--target=x86_64-redhat-linux-gnu' '--program-prefix=' '--prefix=/usr' '--exec-prefix=/usr' '--bindir=/usr/bin' '--sbindir=/usr/sbin' '--sysconfdir=/etc' '--datadir=/usr/share' '--includedir=/usr/include' '--libdir=/usr/lib64' '--libexecdir=/usr/libexec' '--localstatedir=/var' '--sharedstatedir=/usr/com' '--mandir=/usr/share/man' '--infodir=/usr/share/info' '--cache-file=../config.cache' '--with-libdir=lib64' '--with-config-file-path=/etc' '--with-config-file-scan-dir=/etc/php.d' '--disable-debug' '--with-pic' '--disable-rpath' '--without-pear' '--with-bz2' '--with-exec-dir=/usr/bin' '--with-freetype-dir=/usr' '--with-png-dir=/usr' '--with-xpm-dir=/usr' '--enable-gd-native-ttf' '--without-gdbm' '--with-gettext' '--with-gmp' '--with-iconv' '--with-jpeg-dir=/usr' '--with-openssl' '--with-pcre-regex=/usr' '--with-zlib' '--with-layout=GNU' '--enable-exif' '--enable-ftp' '--enable-magic-quotes' '--enable-sockets' '--enable-sysvsem' '--enable-sysvshm' '--enable-sysvmsg' '--with-kerberos' '--enable-ucd-snmp-hack' '--enable-shmop' '--enable-calendar' '--without-mime-magic' '--without-sqlite' '--without-sqlite3' '--with-libxml-dir=/usr' '--enable-xml' '--with-system-tzdata' '--enable-force-cgi-redirect' '--enable-pcntl' '--with-imap=shared' '--with-imap-ssl' '--enable-mbstring=shared' '--enable-mbregex' '--with-gd=shared' '--enable-bcmath=shared' '--enable-dba=shared' '--with-db4=/usr' '--with-xmlrpc=shared' '--with-ldap=shared' '--with-ldap-sasl' '--with-mysql=shared,/usr' '--with-mysqli=shared,/usr/bin/mysql_config' '--enable-dom=shared' '--with-pgsql=shared' '--enable-wddx=shared' '--with-snmp=shared,/usr' '--enable-soap=shared' '--with-xsl=shared,/usr' '--enable-xmlreader=shared' '--enable-xmlwriter=shared' '--with-curl=shared,/usr' '--enable-fastcgi' '--enable-pdo=shared' '--with-pdo-odbc=shared,unixODBC,/usr' '--with-pdo-mysql=shared,/usr' '--with-pdo-pgsql=shared,/usr' '--with-pdo-sqlite=shared,/usr' '--with-pdo-dblib=shared,/usr' '--enable-json=shared' '--enable-zip=shared' '--with-readline' '--with-pspell=shared' '--enable-phar=shared' '--with-mcrypt=shared,/usr' '--with-tidy=shared,/usr' '--with-mssql=shared,/usr' '--enable-sysvmsg=shared' '--enable-sysvshm=shared' '--enable-sysvsem=shared' '--enable-posix=shared' '--with-unixODBC=shared,/usr' '--enable-fileinfo=shared' '--enable-intl=shared' '--with-icu-dir=/usr' '--with-recode=shared,/usr'
/etc/php.d/pdo_sqlite.ini,
/etc/php.d/sqlite3.ini,
PHP Warning:  Unknown: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Europe/Berlin' for 'CET/1.0/no DST' instead in Unknown on line 0
PDO drivers => mysql, sqlite
pdo_sqlite
PWD => /root/sqlite
_SERVER["PWD"] => /root/sqlite
_ENV["PWD"] => /root/sqlite
    
por www.data-blogger.com 12.11.2011 / 12:22

2 respostas

3

instale o php sem ele e depois instale o pacote: php5-sqlite3 em seguida, reinicie o apache para que ele funcione.

    
por 12.11.2011 / 12:29
2

but we used the --without-sqlite3 command when compiling PHP. (It stands in the 'Configure Command' column)

Não. Você não especificou. É a opção padrão ao instalar o pacote binário.

But, it is very risky to recompile PHP on that server; there are many visitors.

--without-xx da coluna Configurar Comando na página phpinfo() não significa que você tenha que recompilar o PHP para ativar. Por exemplo, você pode ver a opção --without-mysql , mas ainda pode instalar php-mysql para ativá-la:

mysql

MySQL Support => enabled
Active Persistent Links => 0
Active Links => 0
Client API version => 5.5.15
MYSQL_MODULE_TYPE => external
MYSQL_SOCKET => /var/lib/mysql/mysql.sock
MYSQL_INCLUDE => -I/usr/include/mysql
MYSQL_LIBS => -L/usr/lib64/mysql -lmysqlclient 

Desde que você instalou o php-pdo package:

/etc/php.d/pdo_sqlite.ini,
PDO drivers => mysql, sqlite
pdo_sqlite
PDO Driver for SQLite 3.x => enabled
SQLite Library => 3.3.6

A extensão sqlite3 já está ativada, mas no nome diferente pdo_sqlite . Basta usá-lo para acessar o banco de dados do SQLite 3.

    
por 12.11.2011 / 17:24