时间:2021-07-01 10:21:17 帮助过:14人阅读
2、老三套
phpize ./configure --with-php-config=/usr/bin/php-config #####error:Cannot find OpenSSL‘s <evp.h> yum install openssl openssl-devel make && make install
在php.ini里加扩展
vim /etc/php.ini
extension=mongodb.so
3、安装MongoDB
添加源,mongodb-1.5.5扩展,最高支持到MongoDB 4.0, 如果安装4.2会出现(Fatal error: Class ‘MongoClient‘ not found in )
vim /etc/yum.repos.d/mongodb-org-4.0.repo
[mongodb-org-4.0] name=MongoDB Repository baseurl=https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/4.0/x86_64/ gpgcheck=0 enabled=1 gpgkey=https://www.mongodb.org/static/pgp/server-4.0.asc
安装
yum install mongodb-org
启动服务
systemctl start mongod.service
开机自启动
chkconfig mongod on
创建数据库
use DATABASE_NAME
为数据库创建用户
db.createUser({user:"username123",pwd:"123456",roles:[{role:"dbOwner",db:"DATABASE_NAME"}]})
验证用户
db.auth("username123","123456")
centos7 php5.5 mongodb安装
标签:god -- vim sele osi epo mongodb安装 amp col