Comments (2)
When I use TLS, it works if I just specify the mongo host with single host name such as
'host' => 'dev2-ent-mongodb1'
(with replicaSet and CAfile etc). But it throw this error when I specify the host as a cluster such as:'host' => 'dev2-ent-mongodb1,dev2-ent-mongodb2,dev2-ent-mongodb3'
.
Neither the PHP driver nor library take a host
option, so it seems like you're using another library on top of the driver. To get to the root of this issue, please share two scripts using just the driver and library that reproduces successful connection for a single host and error for multiple hosts.
For example:
- Construct a
MongoDB\Client
object with the appropriate connection string and options(s). Note that the full list of supported URI options are documented inMongoDB\Driver\Manager
. - Either select a server (e.g.
$client->getManager()->selectServer()
) or issue a simple command (e.g.$client->admin->command(['ping' => 1])
) to initialize the connection.
So please prepare two scripts (each with the appropriate connection options) and share their output when executing them through a CLI environment. I expect we'll see no output if selectServer()
or command()
succeeds and an uncaught exception otherwise. Once we have that, we can look at what the driver is doing directly.
The PHP driver's TLS is handled by whatever library is linked by libmongoc (and detected during compilation). This will most likely be OpenSSL, but the particular version of OpenSSL used may still differ from other applications (e.g. Mongo Studio 3T) if you happen to have multiple versions on your system. We can confirm exactly what libmongoc uses by running ldd /path/to/mongodb.so
(where /path/to/mongodb.so
is the compiled PHP extension). For instance, on my system:
$ ldd ~/phpc/modules/mongodb.so
linux-vdso.so.1 (0x00007ffc2fd63000)
libsnappy.so.1 => /usr/lib/x86_64-linux-gnu/libsnappy.so.1 (0x00007efc2b98c000)
libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007efc2b970000)
libzstd.so.1 => /usr/lib/x86_64-linux-gnu/libzstd.so.1 (0x00007efc2b8c7000)
libsasl2.so.2 => /usr/lib/x86_64-linux-gnu/libsasl2.so.2 (0x00007efc2b8aa000)
libssl.so.1.1 => /usr/lib/x86_64-linux-gnu/libssl.so.1.1 (0x00007efc2b817000)
libcrypto.so.1.1 => /usr/lib/x86_64-linux-gnu/libcrypto.so.1.1 (0x00007efc2b541000)
libicuuc.so.66 => /usr/lib/x86_64-linux-gnu/libicuuc.so.66 (0x00007efc2b359000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007efc2b336000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007efc2b144000)
libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007efc2af62000)
libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007efc2af47000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007efc2af41000)
libicudata.so.66 => /usr/lib/x86_64-linux-gnu/libicudata.so.66 (0x00007efc2947e000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007efc2932f000)
/lib64/ld-linux-x86-64.so.2 (0x00007efc2bbf0000)
The "IP address mismatch" error suggests that the certificate is actually being properly checked by OpenSSL and the root issue is likely an incorrect certificate configuration. You should also be able to verify the certificate directly using the openssl verify command and the -verify_ip <ip>
and -verify_hostname <hostname>
options. That would help you debug the certificate issue independent of the PHP driver (and MongoDB).
from mongo-php-library.
Note: I restored the original bug report contents since this may be relevant to other users that come across the same error message down the line.
from mongo-php-library.
Related Issues (20)
- PHP+MongoDB: "Return value must be of type MongoDB\Driver\Server, null returned" HOT 3
- Can we drop `jean85/pretty-package-versions:1.2`? HOT 4
- Decision about `mongo-orchestration` folder and `Makefile` HOT 3
- [Documentation] Syntax highlighting in the method reference is not ideal HOT 1
- A never-ending query after upgrade to MongoDB 6.0.3 HOT 6
- Memory leak on updateOne in the loop HOT 1
- Deprecated: Return type of MongoDB\Model\BSONDocument::bsonSerialize() HOT 2
- The StreamWrapper class is currently unusable without the bucket HOT 4
- Performance issue with PHP 8.2 HOT 2
- Extract mongodb-1.6.2.tgz error HOT 1
- MacOs M1 Cannot connect to Atlas After upgrade driver HOT 7
- This is a test
- $unset not properly work on multiple field? HOT 1
- Docs: missing `]` character in database->aggregate documentation HOT 1
- Question about fieldPaths (feature request?) HOT 1
- Non blocking io HOT 1
- $where is not allowed in this context HOT 2
- getting result from mongodb with toArray() HOT 3
- Getting the error in driver version 1.14 HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mongo-php-library.