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.
64-bit MSI
version for windows .msi file and run.(C:\Program Files\MongoDB\Server\3.0\bin)
into your environment variable to access MongoDB from the command line.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.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″C:\user\palam>
) and type mongo mongo -version
and press ‘ENTER’, You will see the installed version of MongoDB.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.
You can get all mongodb collections on http://localhost:3001
url, You need to open (http://localhost:3001
) on any browser.
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.
Xampp/Wamp
.dll
file from PEAR Directory, please make sure .dll
file must be compatible with your PHP version..dll
file into your PHP extension (\ext)
directory, mine xampp location is (D:\xampp\php\ext\)
.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..dll
file is not compatible with your PHP version.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.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.
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
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
This Laravel tutorial helps to understand table Relationships using Elequonte ORM. We'll explore laravel table Relationships usage and best practices… Read More
We'll explore different join methods of Laravel eloquent with examples. The join helps to fetch the data from multiple database… Read More
in this Laravel tutorial, We'll explore valet, which is a development environment for macOS minimalists. It's a lightweight Laravel development… Read More
I'll go through how to use soft delete in Laravel 10 in this post. The soft deletes are a method… Read More
View Comments
Update your PEAR DIRECTORY link in order to point to: https://pecl.php.net/package/mongodb
if Mongo not working of adding 'extension=php_mongo.dll' this line then you can add 'extension=php_mongo'