Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

We are using PHP 5.3.6 here, but we used the --without-sqlite3 command when compiling PHP. (It stands in the 'Configure Command' column). But, it is very risky to recompile PHP on that server; there are many visitors. How can we install/use sqlite3?

Regards, Kevin

[EDIT]

yum repolist gives:

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 gives:

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 gives:

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
share|improve this question
    
Are you running CentOS? And PHP is installed with yum, not compiled from source? –  quanta Nov 12 '11 at 11:30
    
I'm not sure wether PHP was installed through yum (I thought so). And yes, it's on CentOS. –  Kevin Nov 12 '11 at 11:35
    
Edit your original post and append the output of yum repolist and rpm -qa | grep php? –  quanta Nov 12 '11 at 11:36
    
It's added to the post ;) –  Kevin Nov 12 '11 at 11:40
    
php -i | grep sqlite? –  quanta Nov 12 '11 at 11:58
show 1 more comment

2 Answers 2

up vote 2 down vote accepted

install php without it and then install the package: php5-sqlite3 then restart apache to make it work.

share|improve this answer
    
It then says: "No package php5-sqlite3 available." (when using yum install php5-sqlite3) –  Kevin Nov 12 '11 at 11:31
    
to get verify that if it is present in Yum repor, run "yum search sqlite | grep php", it will give you exact package name. install that php sqlite package. –  Farhan Nov 12 '11 at 11:39
    
:(, it gives: php-pear-Log.noarch : Abstracted logging facility for PHP –  Kevin Nov 12 '11 at 11:43
    
Add new reposirtory "EPEL" to yum by "wget download.fedora.redhat.com/pub/epel/5/i386/… " and then install this rpm through "rpm ivh epel*"... considering that you are using RHEL 5 or CentOS 5. then run the yum search command i gave to you. –  Farhan Nov 12 '11 at 11:46
    
That url doesn't exists :(.. –  Kevin Nov 12 '11 at 12:52
show 2 more comments

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

No. You didn't specify. It's the default option when installing binary package.

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

--without-xx from the Configure Command column in the phpinfo() page doesn't mean you have to recompile PHP to enable. For example, you can see --without-mysql option but you still can install php-mysql to enable it:

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 

Since you installed 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

The sqlite3 extension is already enabled, but in the different name pdo_sqlite. Just use it to access to the SQLite 3 database.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.