Hướng dẫn install mongodb wamp

Everyone has heard about Mongo DB. MongoDB is an open-source tool that supports NoSQL. It is document-oriented not object-oriented. MongoDB is usually used when large data is set to manage information. Here we discuss the installation of MongoDB on Wamp. Before we know about what is Mongo DB and its features. Let’s discuss this shortly. 

Mongo DB

Mongo DB is an open-source NoSQL information-based administration program. NoSQL is utilized as an alternative option to a traditional relational database. Mongo is quite useful for working with large sets of distributed data. Mongo DB is used to manage document-oriented information, and store or receive data. 

Features of Mongo DB 

Below we listing the features of Mongo DB,

  1. Ad-hoc queries for optimization of real-time analysis. 
  2. Indexing for better query optimization.
  3. Replication for data stability.
  4. Sharding.
  5. Load balancing.

Requirements 

Kindly install,

  1. PHP extension 
  2. wamp server 
  3. Apache

Steps to Install Mongo DB on WAMP

Below is the list of instructions that follow to install the MongoDB driver on the wamp server. 

  • Download .delete file                              

Download the .dll file from this linkhttps://pecl.php.net/package/mongo/1.6.11/windows, remember that version that you download is compatible with your PHP version. Unzip the folder.                     

Hướng dẫn install mongodb wamp

  • Put .dll file into PHP extension            

Copy .dll file and paste into php extension directory.

Hướng dẫn install mongodb wamp

  • Open the php.ini file                                          

Open the php.ini file for adding the mongo DB extension. 

  • Enable php_mongo.dll extension            

Search below line into php.ini file,                  

extension=php_mongo.dll                                   

If found then okay, otherwise add this line into php.ini. Don’t forget to remove semicolons. 

Hướng dẫn install mongodb wamp

Restart the wamp server                                  

Restart the wamp server, if found any error then mongo DB is not installed. 

  • Check whether drivers installed or not                  

After installation is done then open phpinfo() file to check mongo DB drivers.

Hướng dẫn install mongodb wamp

Conclusion 

By following the above steps you can able to install MongoDB drivers on the wamp server. I hope you clear all the steps and follow them as per the given order.

Cài đặt Mongodb và wamp chạy ứng dụng php đầu tiên

Mongodb là một CSDL  dạng NoSQL có  không ràng buộc nói đơn giản là  cơ sở dữ liệu mà không dùng mô hình dữ liệu quan hệ .
B1 - kiểm tra cài đặt đúng phiên bản mongo và php , wamp server
 A - mongodb chọn phiên bản http://www.mongodb.org/downloads phù hợp hệ điều hành
download về copy file về thư mục C:\bin

 B- cài đặt mongo_db.dll -phiên bản phù hợp với php hiện tại
--để biết phiên bản php phù hợp với phần nào ta vào phpinfo() để kiểm tra :
ở đây là  bản cũ VC6
PHP Extension Build-API20090626,TS,VC6

Hướng dẫn install mongodb wamp

tại đây http://downloads.php.net/pierre/
hay tại đây
https://github.com/mongodb/mongo-php-driver/downloads

 sau khi chọn  download file  php_mongo.dll  phù hợp copy vào thư mục của wamp

Hướng dẫn install mongodb wamp

C:\wamp\bin\php\php5.3.5\ext

để wamp nhận biết cần mở php.ini tìm hay thêm dòng này vào 
extension=php_mongo.dll

Hướng dẫn install mongodb wamp

 

reset lại wamp
B2: Chạy thử và Tạo Database

cấu hình ngắn gọn để gọi mongo

vào mycomputer->properties ->environment variables -> tìm path và edit  thêm C:\bin vào

Hướng dẫn install mongodb wamp

Hướng dẫn install mongodb wamp

1-khởi động mongod bằng cách mở cmd gõ vào

mongod --dbpath C:/bin

Hướng dẫn install mongodb wamp


ok xong
2-để nguyên cửa sổ đang chạy mongod- mở tiếp cửa sổ thứ 2  cmd gõ tiếp

use data

Hướng dẫn install mongodb wamp

trong đó data là tên database cần tạo

db.addUser("admin","pass")

Hướng dẫn install mongodb wamp

tạo username và pass

db.game.save({user:"so1",pass:"pass"})

Hướng dẫn install mongodb wamp

để tạo bảng game
để truy vấn bảng

db.game.find()

3 Tạo 1 file php để thử insert dữ liệu vào xem sao
nội dung file php như sau


$mongodb = new Mongo();
$db = $mongodb->prox; // select database
$collection = $db->game; // select collection
$arr = array(
"user" => "haha",
"user_pass" => ""
);
$collection->insert($arr);
?>

xem thử kết quả
db.game.find()

Hướng dẫn install mongodb wamp

 

quản lý mongodb với rockmongo user nam và pass là admin