为PHP安装MongoDB(php-mongo)扩展

How to add mongo support to PHP 5 in CentOS ?
If you have SSH access and root you should be able to follow the “Installing on *NIX” instructions (the RPMs are just created for convenience sake.)

You can try using pecl … PECL is a repository for PHP Extensions and the mongo php driver uses that system.

Here is a blog post you might find helpful …

http://learnmongo.com/posts/mongodb-php-install-and-connect/

Install instructions from that post …

Command Line Install for Linux

Via your command line run pecl … (if you use sudo):

$ sudo pecl install mongo

If you are already root …

# pecl install mongo

If you get an error saying the system can’t find phpize then you may need to install the PHP dev package (this is how you do if your OS has aptitude, you might need to use some other method to install the PHP dev packaes) …

$ sudo aptitude install php5-dev

You will then need to edit your php.ini file add add the mongo.so extension:

extension=mongo.so

Restart your webserver and you are done.

发表回复

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

此站点使用Akismet来减少垃圾评论。了解我们如何处理您的评论数据