We are moving our forum in GitHub Discussions. For questions about Phalcon v3/v4 you can visit here and for Phalcon v5 here.

Phalcon ODM Mongodb 3 support

I can't connect to MongoDb server using Phalcon php. It alwas failed to login to the server. I am using latest version of Mongodb (Version 3). I am using latest driver for Mongodb (on Windows). I am always getting Internal server error while I am trying to connect to Mongo DB

Do the apache shows any useful info?

edited Mar '16

Finally confirmed. Phalcon PHP does not support MongoDB 3.x version

More at https://github.com/mongodb/mongo-php-driver

edited Mar '16

I am not sure about Phalcon2. But currently using Phalcon 1.3.4 with Mongo 3.2.4 without any problems. In next week will upgrade to 2.x.

UPD: But looks like on my system legacy mongo extesion. WIll check and update.

UPD2: Yes Phalcon uses legacy driver within they code. https://php.net/manual/ru/book.mongo.php And with this driver my app works fine with Mongo 3.2.4.


Please chek again. MongoDB 3 is using different type of authentication than 2.x. Even old windows clients does not work with Version 3.x

I am using hosted version on MongoDB (mlab.com). The DB version is 3.0.7. Earlier when they are using 2.x version, it was working without any problem.

edited Mar '16

Checked again. Before i was used it without auth because i used it on localhost.

My env:

  1. Ubuntu 14.04
  2. PHP 5.6
  3. Mongo 3.2.4
  4. Phalcon 1.3.4

Now setuped with authentication. New driver https://github.com/mongodb/mongo-php-library: Connection successfull, but got error from Phalcon\Mvc\Collection, because it use interface from another driver.

new \MongoDB\Client("mongodb://superuser:[email protected]:27017");

Old driver https://php.net/manual/ru/book.mongo.php Evertything works fine. Had problem with authentication, with driver version 1.4, after update to 1.6 everything works fine "pecl upgrade mongo".

new \MongoClient("mongodb://superuser:[email protected]:27017");


Also here is list of driver compatability - https://docs.mongodb.org/ecosystem/drivers/php/ . And mongo-1.6 compatible with 3.0, but i used it with 3.2 without problems, may be some features does not work, but then i dont't use them .