无废话 MongoDB 及 PHP 扩展编译安装

操作系统环境:Gentoo Linux

需要使用 scons 编译安装:

emerge scons

安装 mongodb 依赖库:

emerge boost
emerge libpcre
export CFLAGS=”-DJS_C_STRINGS_ARE_UTF8″ # 编译spidermonkey支持utf8
emerge spidermonkey

安装 mongodb:

# 1.6.5 版本

cd /work/setup
wget http://downloads.mongodb.org/src/mongodb-src-r1.6.5.tar.gz
tar zxf mongodb-src-r1.6.5.tar.gz
cd mongodb-src-r1.6.5
scons all
scons –full install

# 2.0.0 版本(2011-09-13 更新)

cd /work/setup
wget http://downloads.mongodb.org/src/mongodb-src-r2.0.0.tar.gz
tar zxf mongodb-src-r2.0.0.tar.gz
cd mongodb-src-r2.0.0
scons all
scons –full install

启动 mongodb 服务器:
创建默认的数据库目录,创建后启动 mongod:

mkdir -p /data/db
/usr/local/bin/mongod

在系统自动启动队列文件 /etc/conf.d/local.start 中添加:

/usr/local/bin/mongod –fork –logpath /var/log/mongodb.log –logappend

安装 PHP 扩展:

wget http://pecl.php.net/get/mongo-1.1.4.tgz
tar zxf mongo-1.1.4.tgz
cd mongo-1.1.4
/usr/local/php/bin/phpize
./configure –with-php-config=/usr/local/php/bin/php-config
make && make install

# 2011-09-13 更新

wget http://pecl.php.net/get/mongo-1.2.4.tgz
tar zxf mongo-1.2.4.tgz
cd mongo-1.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

— EOF —

《无废话 MongoDB 及 PHP 扩展编译安装》有7个想法

  1. Thank you a bunch for sharing this with all of us you really understand what you are speaking about! Bookmarked. Please additionally consult with my web site =). We can have a link exchange contract among us!

  2. I’ve been absent for some time, but now I remember why I used to love this site. Thanks , I will try and check back more frequently. How frequently you update your website?

  3. Hi there excellent website! Does running a blog like this require a lot of work? I have very little expertise in computer programming but I had been hoping to start my own blog in the near future. Anyways, if you have any recommendations or tips for new blog owners please share. I know this is off subject however I just had to ask. Kudos!|

发表评论

电子邮件地址不会被公开。 必填项已用*标注