标签:local
wget ‘https://codeload.github.com/mongodb/mongo-php-driver/zip/master‘ -O /usr/local/src/mong_php.zip
cd /usr/local/src/
unzip mong_php.zip
cd mongo-php-driver-master/
/usr/local/php/bin/phpize
./configure --with-php-config=/usr/local/php/bin/php-config
make && make install
vi /usr/local/php/etc/php.ini //增加 extension = mongo.so
/usr/local/php/bin/php –m
重启apache重新加载php
测试
vi /usr/local/apache2/htdocs/1.php //增加<?php// 连接到mongodb$m = new MongoClient();echo "Connection to database successfully";// 选择一个数据库$db = $m->mydb;echo "Database mydb selected";?>
curl localhost/1.php
本文出自 “愺艮搥豩” 博客,谢绝转载!
标签:local
原文地址:http://riverxyz.blog.51cto.com/533303/1825794