Linux上安装 MongoDB ZK MEMCACHE PHP扩展

时间:2022-11-29 10:10:39

安装mongo扩展:

下载地址:https://github.com/mongodb/mongo-php-driver,下载该源码包

/usr/local/php/bin/pecl install mongo

 

安装zk扩展:

1.安装libzookeeper

cd /usr/local/src/zookeeper-3.4.6/src/c
./configure --prefix=/usr/local/zookeeper
make
make install

2.安装php zk扩展

cd /usr/local/src/
wget http://pecl.php.net/get/zookeeper-0.2.2.tgz tar xf zookeeper-0.2.2.tgz
cd zookeeper-0.2.2
phpize
./configure --with-php-config=/usr/local/php/bin/php-config --with-libzookeeper-dir=/usr/local/zookeeper/
make
make install

 

安装memcache扩展:

tar xf memcache-2.2.7.tgz
cd memcache-2.2.7
/usr/local/php/bin/phpize
./configure --enable-memcache --with-php-config=/usr/local/php/bin/php-config
make
make install

安装redis扩展:

tar xf phpredis-2.2.4.tar.gz
cd phpredis-2.2.4
/usr/local/php/bin/phpize
./configure --with-php-config=/usr/local/php/bin/php-config
make
make install

php.ini文件添加:

extension=mongo.so
extension=redis.so
extension=zookeeper.so
extension=memcache.so
extension_dir = /usr/local/php-5.5.22/lib/php/extensions/no-debug-non-zts-20121212/
使支持短tag
202 short_open_tag = On