CentOS under the detailed installation process of PHP using MongoDB

Source: Internet
Author: User
Tags install mongodb yum install mongodb
This article is about the complete installation configuration process for using MongoDB under CentOS.

Replace the Yum source

We want to install it through Yum, so it's quicker to compare, but the CentOS default Yum environment doesn't have what we need, so we need to proactively change the source of the Yum source to 163.

First Get 163 sources:

# wget http://mirrors.163.com/.help/CentOS6-Base-163.repo

Then we will back up our own native Yum:

#mv CentOS-Base.repo CentOS-Base.repo.bak

Then change the downloaded 163 source to a native source:

#mvCentOS6-Base-163.repo CentOS-Base.repo

Next the Yum source Update operation:

#yum clean all#yum makecache#yum update -y

This new Yum source is configured to complete.

Installing the MongoDB Database

Next we need to install the MongoDB database under CentOS.

#yum instll mongodb

Then install the server side:

#yum install mongodb-server

Next start MongoDB:

#service mongod start

Then enter MONGO:

#mongo

The above results show that MongoDB installation is successful.

Configuring Php-mongo Extensions

or install via Yum:

#yum install php-pecl-mongo

Php_info () will display MONGO after successful installation:

Test MongoDB

Test MongoDB with PHP code to see if it works:


    
     $mongo = new Mongo();$alldb = $mongo->listDBs();//获取所有数据库名称echo$alldb;

If normal returns, the PHP operation MongoDB is successful.

The following specific additions and deletions to check the API: Official documents

'). addclass (' pre-numbering '). Hide (); $ (this). addclass (' has-numbering '). Parent (). append ($numbering); for (i = 1; i <= lines; i++) {$numbering. Append ($ ('
  • '). Text (i)); }; $numbering. FadeIn (1700); }); });

    The above describes the CentOS under the use of the MongoDB detailed installation process, including the CentOS6 aspects of the content, I hope that the PHP tutorial interested in a friend helpful.

  • 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.