Skip to content
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

PHP Fatal error #569

Closed
com0t opened this issue Jul 30, 2018 · 5 comments
Closed

PHP Fatal error #569

com0t opened this issue Jul 30, 2018 · 5 comments

Comments

@com0t
Copy link

com0t commented Jul 30, 2018

I try run php show.php
==> error
PHP Fatal error: Uncaught MongoDB\Driver\Exception\RuntimeException: Server at localhost:27017 reports wire version 2, but this version of libmongoc requires at least 3 (MongoDB 3.0) in /var/www/html/vendor/mongodb/mongodb/src/Collection.php:612 Stack trace: #0 /var/www/html/vendor/mongodb/mongodb/src/Collection.php(612): MongoDB\Driver\Manager->selectServer(Object(MongoDB\Driver\ReadPreference)) #1 /var/www/html/test/show.php(8): MongoDB\Collection->find(Array, Array) #2 {main} thrown in /var/www/html/vendor/mongodb/mongodb/src/Collection.php on line 612
Help me?

@jmikola
Copy link
Member

jmikola commented Jul 30, 2018

This exception is thrown by the driver (i.e. mongodb extension), not the library. Version 1.5.0 of the driver dropped support for communicating with MongoDB server versions 2.6 and earlier. For the most part, the wire versions are an internal detail, but we do document how they map to server versions in this specification document.

What version of MongoDB are you attempting to connect to?

@derickr
Copy link
Contributor

derickr commented Oct 2, 2018

Closing as no new comments were added for two months. Please reopen if you can provide further information.

@derickr derickr closed this as completed Oct 2, 2018
@evgmel
Copy link

evgmel commented Oct 18, 2018

This answer helped me to solve the problem with error:

Server at 10.116.0.185:27017 reports wire version 2, but this version of libmongoc requires at least 3 (MongoDB 3.0)

@jmikola
Copy link
Member

jmikola commented Oct 19, 2018

@evgmel: The Stack Overflow answer you linked appears to suggest downgrading the driver to a version before 1.5.0 (e.g. pecl install mongodb-1.4.4). This wire protocol exception is thrown when a current version of the driver (1.5.x series) connects to a MongoDB server whose version is 2.6 or earlier. MongoDB 2.6 was end-of-lifed in October 2016 and has been unsupported for two years. Assuming the OP was running such an old version of the server, they would do better to upgrade to a supported version and continue to use an actively maintained version of the driver.

@tiagofrancafernandes
Copy link

This works for me in 2022-07

pecl uninstall mongodb
pecl install mongodb-1.9.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants