CentOS6.3 install MongoDB2.2 and install PHP MongoDB client

Source: Internet
Author: User
Tags create mongodb install php install mongodb mkdir mongodb mongodb client php mongodb

Download Source: (Put in the/USR/LOCAL/SRC directory)
To the official website http://www.mongodb.org/downloads Download source code
Https://fastdl.mongodb.org/linux/mongodb-linux-i686-2.2.7.tgz (32-bit)
Note: 32-bit system installation 32-bit, 64-bit system installed 64-bit!

Install MongoDB

The code is as follows Copy Code

mv./bi N/usr/local/mongodb

TAR-XZVF./ Mongodb-linux-i686-2.2.7.tgz
# Create MongoDB user and MongoDB user group

Groupadd MongoDB
useradd-g mongodb-s/usr/sbin/nologin mongodb
Chown-r mongodb:m Ongodb/usr/local/mongodb

Echo/usr/local/mongodb/bin/mongod--dbpath=/usr/local/ Mongodb/data--logpath=/usr/local/mongodb/logs/mongodb.log--fork ">>/etc/rc.local

/usr/local/mongodb/bin/mongod--dbpath=/usr/local/mongodb/data--logpath/usr/local/mongodb/logs/ Mongodb.log--fork

#将27017端口加入防火墙 (Reference: CentOS6.3 compile installation memcached)
Note: The database port and the Web port, 27017 and 28017 respectively, open http://localhost:28017 in the browser, and you can see some relevant information.

The code is as follows Copy Code
Service iptables restart//reboot firewall

Problems that may arise:

Question one:
-bash:/usr/local/bin/mongo:/lib/ld-linux.so.2:bad ELF interpreter: Without that file or directory

The code is as follows Copy Code
Yum Install ld-linux.so.2

Question two:
mongo:error while loading shared libraries:libstdc++.so.6:cannot open Shared object File:no such file or director Y


The code is as follows Copy Code

Yum Whatprovides libstdc++.so.6

Yum Install llibstdc++.so.6

Install the PHP MongoDB client

The code is as follows Copy Code

Wget-c http://pecl.php.net/get/mongo-1.4.4.tgz
/usr/local/php/bin/phpize # Use PHP's phpize command to install extensions
Make && make install

When you are finished, edit your php.ini file to add one line.

  code is as follows copy code
extension= mongo.so
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.