2
votes

I´m trying to add the driver for mongoDB in xampp(PHP). xampp version is 3.2.1 with Current PHP version: 5.5.11

I placed the compatible php_mongo.dll(which was originally php_mongo-1.5.7-5.5-vc11.dll, so it is compattible with php 5.5) in the ext folder, I added extension=php_mongo.dll to the end of my php.ini file

when I try to start the apache server using xampp, xampp gives me the warning "PHP Startup:"(blank space)

and can't find the Mongo class, so the driver is not loading.

am I doing something wrong? Can I use something else besides xampp and easier?

1

1 Answers

0
votes

I did for Php 5.6, MongoDb 3.4, hope it will help to you

Follow below steps to make Mongo work for PHP-5.6

  • goto https://pecl.php.net/package/mongo/1.6.14/windows
  • download php_mongo-1.6.14-5.6-ts-vc11-x86.zip
  • extract the zip file and copy php_mongo.dll
  • open PHP ext directory and paste the dll file
  • add the following line to your php.ini file
    extension=php_mongo.dll
  • restrat apache and test with below php code

    echo extension_loaded("mongo") ? "loaded\n" : "not loaded\n";

    $m = new MongoClient("mongodb://127.0.0.1:27017");

    echo "Connection to database successfully";

    $db = $m->testdb; // where testdb is already existing Database

    echo "Database testdb selected";

Note : Check the "mongo" module is loaded or not using phpinfo()