安装Berkeley DB:
wget http://download.oracle.com/berkeley-db/db-6.0.20.tar.gz
tar zxvf db-6.0.20.tar.gz
cd db-6.0.20/build_unix/
../dist/configure --prefix=/usr/local/berkeleydb --enable-cxx
make && make install
安装PHP扩展:
cd ../lang/php_db4/
phpize
./configure --with-db4=/usr/local/berkeleydb/
make && make install
echo 'extension=db4.so' >> /etc/php.ini
简单使用:
<?php
$db = new Db4();
$db->open(null, "/var/tmp/db4", "test");
$db->put('key', 'value');
$db->get('key');
?>
http://www.oracle.com/technetwork/products/berkeleydb/downloads/index-082944.html