-
Notifications
You must be signed in to change notification settings - Fork 266
Connection fail due to ssl #348
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
Could you attempt capturing some trace information via the mongodb.debug INI option? If you're running in a web server context, you can set this to a writable directory, which will cause the driver to dump one file per request. Alternatively, you can use "stderr" if running the script from a CLI context. These logs are quite verbose, so I would suggest either doing it only for a single request. You can enable the setting at runtime with Additionally, let's check that you can verify the certificate using PHP's OpenSSL extension:
Depending how the MongoDB server is configured, you may get a simple HTTP response with "It looks like you are trying to access MongoDB over HTTP on the native driver port." or an error if HTTP traffic is being filtered. That's fine, as we're mainly interested in the certificate contents and whether it can be verified. Note: this is roughly the same investigative process previously done with another user in #313. |
In the future, please stick to text files instead of PDFs. If you're unable to validate the certificate with PHP's vanilla stream functions, this hints at a general issue with your PHP or OpenSSL environment. I don't believe it's an issue with the server certificate itself, as that appears to be fine according to some checking tools (e.g. DigiCert, Symantec). Looking at the MySQL example from your repository, it appears that you had to provide a root certificate manually (
That said, this would only be a work-around for resolving your PHP and OpenSSL environment. On a side note, https://github.com/Deamon51/AzureOssPHPSample/ currently contains credentials for your MySQL and MongoDB servers. I'd suggest you move those strings to an ignored file and follow steps in https://help.github.com/articles/removing-sensitive-data-from-a-repository/ to clean up any remnants of the sensitive data. |
I forgot to specify this in my first post, but all works fine when I run the application https://github.com/Deamon51/AzureOssPHPSample/ on docker images, it's doesn't work only in local on my Mac environment. What do you mean by "Our ca_file option should correlate with the $ca argument you pass to mysqli::ssl_set()" Thank's for the sensitive data. I will remove it, I totally forgot ! |
In your example app, you're passing the path to a PEM file as the third argument to Both of these are related to the PHP's |
Thanks for your help. Let me try to recap: It seems that I have an issue with my PHP and OpenSSL environment. To workaround it, your suggestion would be to use the MongoDB driver the same way I use the PHP driver, by providing a root certificate manually, thanks to the ca_file option. That's an interesting workaround but do you have an idea on how I can investigate more on the PHP and OpenSSL environment issue to fix it? Thanks again |
Does the MySQL driver verify the host without explicitly providing a CA file? Also, can you share a paste of the By default, I believe the mysqli extension uses mysqlnd, which relies on PHP's streams and OpenSSL extension. In that case, the OpenSSL INI options may override the default system config for OpenSSL (e.g. |
Also, let's also confirm that the supplying the CA file to
If this is specific to the Mac environment, you may have multiple versions of OpenSSL installed (e.g. Homebrew, native OS), each of which may have different configurations. |
Thanks for all @jmikola , my problem has been solved. |
Hello,
I’m having trouble connecting my PHP app to MongoDB through SSL with the new MongoDB PHP extension and the MongoDB library for PHP
All seems to be well (screenshot of my php.ini) but I have the following error :
I tried to change extension=mongodb.so in php.ini by the full path at the end of file extension="/Applications/MAMP/bin/php/php7.0.15/lib/php/extensions/no-debug-non-zts-20131226/mongodb.so" but in both case it’s doesn’t work.
The text was updated successfully, but these errors were encountered: