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

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

作者:Larry 时间:2010-12-23 分类:服务器 评论:0条 浏览:2230

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.

原创文章,转载请注明: 转载自www.webmaster.me

本文链接地址: 为PHP安装MongoDB(php-mongo)扩展

相关推荐
更多

发表评论

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

*

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