16

Will I be able to connect to this database using PHP's php_mongo.dll driver?

If so, could you please provide some sample code?

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
user1063715
  • 191
  • 1
  • 1
  • 3

4 Answers4

21

MongoDB requires its own driver.

In your case, the PHP driver is located here: http://php.net/manual/en/book.mongo.php

The instructions for installing it are on that page. There is also some sample code.

Gates VP
  • 44,957
  • 11
  • 105
  • 108
4

I think that PDO is only for relational databases. There's no PDO driver for MongoDB.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
3

There is list of databases which you can use with the PDO driver: http://php.net/manual/en/pdo.drivers.php. MongoDB is not among them.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
fojt
  • 66
  • 2
  • 5
1

You can use the PHP PDO OBDC library, if you install MongoDB BI Connector and MongoDB ODBC Driver for BI Connector.

I haven’t tried it, but I’m about to - keep you posted.

https://www.mongodb.com/download-center/bi-connector https://docs.mongodb.com/bi-connector/master/reference/odbc-driver/

Star
  • 13
  • 2