It Support Development ): Install Mongodb Driver For Php On

Join GitHub today

Mongo

Create a thread on Plesk UserVoice to vote for including MongoDB driver into Plesk PHP. Manual extension installation: Warning: If /tmp is mounted with no-exec option, PECL will be unable to install modules.

  • Manually Installing the MongoDB PHP Driver. For driver developers and people interested in the latest bugfixes, you can compile the driver from the latest source code on » Github.Run the following commands to clone and build the project.
  • MongoDB PHP Driver. This extension is developed atop the libmongoc and libbson libraries. It provides a minimal API for core driver functionality: commands, queries, writes, connection management, and BSON serialization.
  • 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 as I was not able to get it in any forum? Php mongodb drivers.

GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.

It Support Development ): Install Mongodb Driver For Php Onclick

Sign up New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Comments

commented Oct 1, 2016

Version
1.13.5

Steps to reproduce the bug

  1. Install ubuntu 16.04 and php, this will give you PHP 7.
  2. Follow the steps on: http://docs.learninglocker.net/installation/

Expected behaviour
I expected LearningLocker to be able to install.

Actual behaviour
It is breaking because LearningLocker uses the legacy mongodb php driver. This driver doesn't support php7, this is what happens when I try to install the driver using pecl (the pecl package for this driver is called mongo):

There is a new driver, this package is called mongodb and it installs fine, both when installing using pecl and when installing using apt-get install php-mongodb. However, LearningLocker cannot use this driver and this is the output I'm getting when I try to install LearningLocker using composer:

Additional information
OS: Ubuntu 16.04
Browser: N/A - I used the command line to install.

commented Oct 1, 2016

Hi @limikael,

Learning Locker does not support PHP 7, the compatibility goes way beyond just the Mongo driver. And would require an entire rewrite to the underlying application.

If you wish to contribute to a new version, then please consider forking the project and submitting pull requests, but as it stands there is no development plan to take the current version of Learning Locker into PHP7.

commented Oct 1, 2016

I see. Thanks anyway!

Merged

commented Jan 9, 2017

It Support Development ): Install Mongodb Driver For Php On Iis

I am curious what is not working in PHP7. We are running PHP7 in our dev environment and learning locker seems to be running fine. Is there a list somewhere of items to be worked on?

commented Jan 10, 2017

Hey @andrewdisney, I'm curious.... Apart from a bit of change in syntax between versions (I believe changes to how Exceptions are handled are a problem moving between 5 and 7) the main problem is the Mongo driver compatbility: https://docs.mongodb.com/ecosystem/drivers/driver-compatibility-reference/#reference-compatibility-mongodb-php

Learning Locker uses the old PHP Mongo driver, which as far as I know has no compatibility with PHP 7. Can you confirm you are running vanilla Learning Locker on PHP 7 using this driver?

commented Jan 10, 2017

That's what I wrote in the initial bug, that the problem was the mongo driver. However, you said at that point @ht2 that the main problem was actually not the driver. You said 'Learning Locker does not support PHP 7, the compatibility goes way beyond just the Mongo driver. And would require an entire rewrite to the underlying application'. So what is the problem, is it the driver or something else?

commented Jan 10, 2017

I said it goes beyond just the Mongo driver...

Laravel 4.2 does not work with PHP 7 (hence my mention of a rewrite to the underlying application) but to be honest we have not used any resources attempting to check that, but please feel free. Here is a potential useful resource as to blockers you might hit: https://laracasts.com/discuss/channels/laravel/laravel-42-and-php-7.

I'd suggest a good first step however would be to rewrite the repositories to use the newer Mongo driver (which is compatible with both PHP 5.x and 7). That could lead onto an update to the core application to work with PHP 7 as well.

commented Jan 10, 2017
edited

Looking here: laravel/framework#11329 it seems that the newest version of 4.2 (4.2.20) has PHP 7 support. Is it possible that the old Mongo driver has also been (unofficially) updated for PHP 7 support too?

commented Jan 10, 2017

Ok I see... I'm not sure if I will have time to hack on this since we actually decided to create our own LRS and use that instead... It is called wp-xapi-lrs and comes as a WordPress plugin, which makes it really convenient to use and install if you are using WordPress. If you are not using WordPress, most of it is implemented as a library which can be used without WordPress. The functionality is kind of limited at the moment, but at least it works to store statements and do basic queries. We would love some feedback @andrewdisney, so if you want, check it out!

commented Jan 10, 2017
edited

No problem - it might be something we look at eventually. It seems that this package (https://packagist.org/packages/mongodb/mongodb) 'implements an API similar to that of the legacy PHP driver' over the top of the new driver, so it could be that by using that package, as well as ensuring v4.2.20 and removing the composer dependency to ext-mongo that it might well work in PHP7, @andrewdisney can confirm their setup I guess.

commented Jan 10, 2017

We did have to add an adapter library the one we used was:
https://github.com/alcaeus/mongo-php-adapter

So we added 'alcaeus/mongo-php-adapter': '^1.0' to our composer.json ran composer and the site seems to work fine. We are still testing though. We don't plan to roll out to our production environment for a few weeks maybe months if there are still compatibility issues.

We have other applications thought that require PHP 7. So that is why I was asking if there was some way we could help with anything not working in PHP 7. Just let us know.

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment
Active1 year, 5 months ago

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 as I was not able to get it in any forum?

NullUserException
68.1k23 gold badges184 silver badges220 bronze badges
user1063715user1063715

3 Answers

Support

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 VPGates VP
40.6k8 gold badges96 silver badges106 bronze badges

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

Paulo LuvisotoPaulo Luvisoto

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

fojtfojt

Not the answer you're looking for? Browse other questions tagged phpmongodbdrivers or ask your own question.