How to Enable MongoDB Extension with XAMPP

8 1 0
                                        


Enabling MongoDB extension (library) for PHP is quite simple, and ready within few steps listed below.

Assuming, XAMPP running on your PC already, create a PHP page: info.php

<?php

// this command will check and tell if mongodb extension is already installed or not.

echo "mongo extension status :: " . extension_loaded("mongo") ?"loaded

" :"not loaded

";

// this will print whole PHP install details (like version, architecture VC version etc)

phpinfo();

?>

Execute this info.php page on browser and search "mongo extension status" and see if value is "loaded" or "not loaded".

If loaded, nothing else to follow, just make a test connection with Mongo server.

If not loaded, then follow these steps to install it.

Note down the values as highlighted below.

System:-windows NT KAPIL-BUDHIRAJA 6.2 build 9200(Window 8 Professional Edition)i586

Build Date: Jun 22 201616:05:20

Compiler:-MSVC11 (Visual C++2012)

Architecture: x86

Open this site, , and download the php_mongo_?.?.?.zip according to your php version.


In my case, I downloaded php_mongo-1.4.5.zip as my php version is 5.5.37
php< 5.5 è php_mongo-1.3.5.zip
php>= 5.5 and php< 6.0 è php_mongo-1.4.5.zip
php>= 6.0 è php_mongo-1.6.8.zip

Download the php_mongo-?.?.?.zip. Unzip it. You will see many files after extraction of zip. Here we need to pick a file based on PHP version + compiler version + architecture version, ex:

php_mongo-?.?.? – <PHP version> – <Compiler version> – <Architecture version> .dll
for my pc I picked this file :php_mongo-1.4.5-5.5-vc11-x86_64.dll

6. Copy this file and paste inside folder "C:\xampp\php\ext".

7. After paste, rename the file as "php_mongo.dll".

8. Open your php.ini file and ask php to load this module during initialization "extension=php_mongo.dll"

9. Restart Apache service.

10. Open your "info.php" page again on Browser and search "Mongo" as well as "mongo extension status". You will see the module loaded already.

I hope this helps

Kamu telah mencapai bab terakhir yang dipublikasikan.

⏰ Terakhir diperbarui: Jun 02, 2017 ⏰

Tambahkan cerita ini ke Perpustakaan untuk mendapatkan notifikasi saat ada bab baru!

How to Enable MongoDB Extension with XAMPPTempat cerita menjadi hidup. Temukan sekarang