Mongo DatabaseWeb Development

Install MongoDB Extension for xampp in Windows

In this web guide you will learn how to install mongodb extension for xampp in windows. Before connecting mongo db to xampp you have to install mongo db library on your windows operating system. Click here to install mongodb in windows.

Steps to install MongoDB Extension in xampp for windows

1. First check that mongo db is running on not by visiting this link http://localhost:27017

If it  is running you will see like below

Mongo DB Installation Windows Screen Shot 13

2. Start up your xampp local server using xampp control panel. Be sure that xampp server and mysql are working as show below

3. Check you PHP Info my visiting link http://localhost/dashboard/phpinfo.php 

Check PHP Info for MongoDB Extension Installation

Note down your PHP Version, Architecture and Thread Safety.

In my case

PHP Version : 5.6.31

Architecture :  x86

Thread Safety : Enabled

4. Now we will download php driver for mongo db. Visit https://pecl.php.net/package/mongodb

A web page will open that will show mongodb drivers versions to download as show below

5. Below chart will show you which version is suitable for your PHP version.

Mongo DB Supported Versions

6. For my php configurations 1.2.10 will be driver version as it supports PHP 5.6. Always choose the latest version of drivers for your configurations.

7. Now look for mongodb version in link you have open https://pecl.php.net/package/mongodb

8. Check your version state, it is stable or not. Do not download unstable version.

MongoDB stable state

For my configs 1.2.10 is stable one. Do not download .tgz files, just click on DLL link related to your version.

A new page will open that will show you information like PHP versions supported, thread safety and architecture.

Match your configurations that you note down in step 3.

In my case configurations was

PHP Version : 5.6.31

Architecture :  x86

Thread Safety : Enabled

I am downloading 5.6 Thread Safe (TS) x86 . 

Thread safe means thread safety is enabled and x86 is architecture.

Adding extension in XAMPP

1. Download DLL file which is in .zip format. Extract that zip file you will get some files like below

MongoDB DLL Files Extract

2. Right click on php_mongodb.dll and copy that file. Now go to folder where you have installed your xampp local server. Open folder  C:\xampp\php\ext

3. You can see many dll files in ext folder. Just paste php_mongodb.dll file in that folder.

4. Now open xampp control panel again and stop all running services. Click on config button just right to Apache and open php.ini file as show below

php.ini settings

php.ini file will open notepad as show below

php.ini file

5. Now type Ctrl + F button to open search bar and seach for word extension=php_bz2.dll

Extension find php.ini

6. Just below any extension write extension=php_mongodb.dll  where php_mongodb.dll is the filename you copy in extension folder of php xampp. Final Settings will be as show below

Mongo DB Extension in php.ini

Save file using Ctrl + S

7. Now open xampp control panel start apache and mysql server.

How to check PHP MongoDB Extension is added in xampp ?

After install mongodb extension in xampp windows you have to check it is working or not follow the steps to check mongodb extension is working or not

  1. First open  http://localhost/dashboard/phpinfo.php link again for checking mongo db extension added or not.
  2. Find mongo db in phpinfo page.

 

 

Tags

Anil Mehra

I am Anil Mehra, a passionate, workaholic and a Full Stack Tech Savvy Programmer with true north towards growth. I have worked on 256 live projects in MNC. I am expertise in the field of Programming, Server Management, SEO, Blogging and SMO...

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button