@@ -53,6 +53,25 @@ SAPI. Additionally, :php:`php_ini_loaded_file() <php_ini_loaded_file>` and
53
53
:php:`php_ini_scanned_files() <php_ini_scanned_files>` may be used to determine
54
54
exactly which INI files have been loaded by PHP.
55
55
56
+ To debug issues with the extension not being loaded, you can use the
57
+ ``detect-extension`` script provided in the tools directory. You can run this
58
+ script from the CLI or include it in a script accessible via your web server.
59
+ The tool will point out potential issues and installation instructions for your
60
+ system. Assuming you've installed the library through Composer, you can call the
61
+ script from the vendor directory:
62
+
63
+ .. code-block:: none
64
+
65
+ php vendor/mongodb/mongodb/tools/detect-extension.php
66
+
67
+ If you want to check configuration for a web server SAPI, include the file in
68
+ a script accessible from the web server and open it in your browser. Remember to
69
+ wrap the script in ``<pre>`` tags to properly format its output:
70
+
71
+ .. code-block:: php
72
+
73
+ <pre><?php require(...); ?></pre>
74
+
56
75
Loading an Incompatible DLL on Windows
57
76
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
58
77
@@ -80,7 +99,7 @@ for the correct environment.
80
99
Server Selection Failures
81
100
-------------------------
82
101
83
- The follow are all examples of
102
+ The following are all examples of
84
103
:doc:`Server Selection </tutorial/server-selection>` failures:
85
104
86
105
.. code-block:: none
@@ -133,3 +152,28 @@ failure:
133
152
but was dropped or otherwise timeout out due to latency.
134
153
- "TLS handshake failed" suggests something related to TLS or OCSP verification
135
154
and is sometimes indicative of misconfigured TLS certificates.
155
+
156
+ In the case of a connection failure, you can use the ``connect`` tool to try and
157
+ receive more information. This tool attempts to connect to each host in a
158
+ connection string using socket functions to see if it is able to establish a
159
+ connection, send, and receive data. The tool takes the connection string to a
160
+ MongoDB deployment as its only argument. Assuming you've installed the library
161
+ through Composer, you would call the script from the vendor directory:
162
+
163
+ .. code-block:: none
164
+
165
+ php vendor/mongodb/mongodb/tools/connect.php mongodb://127.0.0.1:27017
166
+
167
+ In case the server does not accept connections, the output will look like this:
168
+
169
+ .. code-block:: none
170
+
171
+ Looking up MongoDB at mongodb://127.0.0.1:27017
172
+ Found 1 host(s) in the URI. Will attempt to connect to each.
173
+
174
+ Could not connect to 127.0.0.1:27017: Connection refused
175
+
176
+ .. note::
177
+
178
+ The tool only supports the ``mongodb://`` URI schema. Using the
179
+ ``mongodb+srv`` scheme is not supported.
0 commit comments