CentOS Yum installs MongoDB and PHP extensions

Source: Internet
Author: User
Tags install php mongodb server php mongodb

MongoDB is a database based on distributed file storage. Written by the C + + language. Designed to provide scalable, high-performance data storage solutions for Web applications.

One, install the mongodb,php extension

[email protected] ~]# Yum install Php-pecl-mongo MongoDB mongodb-devel mongodb-server  

Two, configure/etc/mongodb.conf

[Email protected] www]# cat/etc/mongodb.conf |awk'{if ($!~/^$/&& $!~/^#/) {print $}}'LogPath=/var/log/mongodb/mongodb.log//Log LocationFork =true                             //running in the backgroundLogappend=true                          //Append LogPort =27017                            //Portdbpath=/var/lib/mongodb//Database Pathpidfilepath=/var/run/mongodb/mongodb.pid//PID Path

It's basically all configured, but why didn't you create the/var/lib/mongodb folder when Yum was installed?

[Email protected] lib]# mkdir-p/var/lib/MongoDB  -R/var/lib/mongodb/  

Third, start the MongoDB server and view

[[email protected] www]#/etc/init.d/mongod start/   / start     / / view    27017  tcp        0      00.0.  0.0:27017               0.0.  0.0:*                   LISTEN      4641/mongod  

So MongoDB will be able to move normally.

Check to see if the PHP extension is loaded,

MongoDB PHP Extension

Four, test php MongoDB Extension

<? PHP   New Mongo ();   = $mongo-Listdbs ();  Print_r ($dbs);   /* * Result: Array ([     databases] + = Array (             [0] = = Array                 (                     [name] + Admin                     [ Sizeondisk] = 1                     [empty] + 1                 )              [1] = = Array                 (                     [name] = + local                     [Sizeondisk] = > 1                     [empty] + 1                 )      [totalsize] = 0     * /  

CentOS Yum installs MongoDB and PHP extensions

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.