: This article mainly introduces the detailed installation process of PHP using mongodb in centOS. if you are interested in the PHP Tutorial, please refer to it. This article describes the complete installation and configuration process for using mongodb in centOS.
Replace yum source
We want to use yum for installation. this is a quick method, but the default yum environment of centOS does not have the content we need. Therefore, we need to manually replace the yum source with 163.
First, obtain the 163 Source:
# wget http://mirrors.163.com/.help/CentOS6-Base-163.repo
Then we will back up our local yum:
#mv CentOS-Base.repo CentOS-Base.repo.bak
Change the downloaded 163 source to the local source:
#mv CentOS6-Base-163.repo CentOS-Base.repo
Next, perform the yum source update operation:
#yum clean all#yum makecache#yum update -y
In this way, the configuration of the new yum source is complete.
Install mongodb
Next, we need to install the mongodb database under centOS.
#yum instll mongodb
Then install the server:
#yum install mongodb-server
Start mongodb:
#service mongod start
Then go to mongo:
#mongo
The above result indicates that mongodb is successfully installed.
Configure the php-mongo extension
Or install it through yum:
#yum install php-pecl-mongo
After the installation is successful, php_info () will display mongo:
Test mongodb
Test mongodb with php code to see if it can run normally:
ListDBs (); // Obtain all database names echo $ alldb;
If the response is normal, the php operation on mongodb is successful.
For more information, see API: official documentation.
'). AddClass ('pre-numbering '). hide (); $ (this ). addClass ('Has-numbering '). parent (). append ($ numbering); for (I = 1; I <= lines; I ++) {$ numbering. append ($ ('
'). Text (I) ;}; $ numbering. fadeIn (1700) ;}) ;}; script
The above describes the detailed installation process of PHP using mongodb in centOS, including the content of CentOS6, and hope to be helpful to anyone interested in PHP tutorials.