Php

Install & Configure MongoDB Driver in XAMPP/WAMP Windows

This tutorial help to install the MongoDB server into windows. I will also let you know the configuration with the PHP server. We will use the MongoDB driver to connect PHP with MongoDB.

MongoDB is a very popular NoSQL database in web development, Here I am creating a series of tutorials about MongoDB with PHP.

I am using windows for the development environment so all the steps are illustrated here for windows. I will cover the following steps regarding MongoDB with PHP.

  1. Installation of MongoDB Server on windows.
  2. Installation of MongoDB driver on xampp.

Steps to install MongoDB Server on Windows

  • Download latest MongoDB 64-bit MSI version for windows .msi file and run.
  • Add bin path (C:\Program Files\MongoDB\Server\3.0\bin) into your environment variable to access MongoDB from the command line.
  • Create data and DB folder under your MongoDB home directory. My installation directory is C, So I have created folder (C:\data\db), as mentioned in MongoDB docs. This is the default directory of mongoDB, so don’t create it anywhere else on the computer.
  • Now open cmd line (C:\user\palam>) and type mongod to start the mongo server, Now you can see a message in the command window – “successfully connected with http://127.0.0.1/27071″
  • Open another cmd line (C:\user\palam>) and type mongo mongo -version and press ‘ENTER’, You will see the installed version of MongoDB.

Mongo Server UI

You can also get web UI of Mongodb as like phpMyAdmin using node module, You can install MongoUI using the below command,
npm i -g mongoui
-g options use to install mongo UI globally, You need to just open the command line and type cmd>mongoui, This command will start mongoui on 3000 port.

Related Post

You can get all mongodb collections on http://localhost:3001 url, You need to open (http://localhost:3001) on any browser.

Install Mongo Driver on Xampp/Wamp

Let’s follow the below steps to install the MongoDB driver in XAMPP for PHP. Mongo is providing a .dll file to install mongo driver as a PHP extension on xampp windows. There are following steps that need to follow to install the mongo driver extension.

Simple Step to Install Mongo Driver on Xampp/Wamp

  1. Download .dll file from PEAR Directory, please make sure .dll file must be compatible with your PHP version.
  2. Put downloaded .dll file into your PHP extension (\ext) directory, mine xampp location is (D:\xampp\php\ext\).
  3. Enable php_mongo.dll extension from you php.ini file, php.ini file location would be (D:\xampp\php\), Open file and search 'extension=php_mongo.dll', if found remove semi-colon ';' otherwise add 'extension=php_mongo.dll' line to enable mongoDB extension for PHP.
  4. Restart Xampp server, if you will get error ‘mondo dll file can not found’ that means your .dll file is not compatible with your PHP version.
  5. After successful installation, please open your php_info file and search mongo if you found mongo as a module that’s mean you have successfully installed mongoDB driver on your xampp.

Conclusion:

We have configured MongoDB on windows, it’s very simple and easy to install MongoDB on windows. We have integrated the PHP mongo driver with the PHP server as well. I have also started the mongo server using the command line on windows.

Please Post questions and queries using the comment section, I will try my best to solve your problem and concern.

Tags: mongo

View Comments

Recent Posts

Configure and Retrieve S3 Information Using Laravel PHP-AWS-SDK

This tutorial helps integrate a PHP SDK with Laravel. We'll install aws-php-sdk into laravel application and access all aws services… Read More

2 months ago

What is the Purpose of php_eol in PHP?

in this quick PHP tutorial, We'll discuss php_eol with examples. PHP_EOL is a predefined constant in PHP and represents an… Read More

8 months ago

Laravel Table Relationship Methods With Example

This Laravel tutorial helps to understand table Relationships using Elequonte ORM. We'll explore laravel table Relationships usage and best practices… Read More

8 months ago

Exploring the Power of Laravel Eloquent Join?

We'll explore different join methods of Laravel eloquent with examples. The join helps to fetch the data from multiple database… Read More

9 months ago

Quick and Easy Installation of Laravel Valet

in this Laravel tutorial, We'll explore valet, which is a development environment for macOS minimalists. It's a lightweight Laravel development… Read More

9 months ago

What is Laravel Soft Delete and How Does it Work?

I'll go through how to use soft delete in Laravel 10 in this post. The soft deletes are a method… Read More

9 months ago

Categories