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