Uncaught exception 'MongoDB\\Driver\\Exception\\ConnectionTimeoutException' with message 'No suitable servers found
592 views
Skip to first unread message
Gulab Pasha
unread,
Sep 26, 2016, 11:17:12 PM9/26/16
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to mongodb-user
Hi Guys,
Help me on the following,
[Mon Sep 26 23:13:44.036909 2016] [:error] [pid 393] [client 49.207.53.70:24604] PHP Fatal error: Uncaught exception 'MongoDB\\Driver\\Exception\\ConnectionTimeoutException' with message 'No suitable servers found (`serverselectiontryonce` set): [Failed connecting to 'localhost:27017': Permission denied]' in /var/www/html/api/dev/v1.0/vendor/mongodb/mongodb/src/Collection.php:187\nStack trace:\n#0 /var/www/html/api/dev/v1.0/vendor/mongodb/mongodb/src/Collection.php(187): MongoDB\\Driver\\Manager->selectServer(Object(MongoDB\\Driver\\ReadPreference))\n#1 /var/www/html/api/dev/v1.0/categories/index.php(79): MongoDB\\Collection->aggregate(Array)\n#2 /var/www/html/api/dev/v1.0/categories/index.php(19): CategoriesAPI->categoriesList('{?? "requestMe...')\n#3 {main}\n thrown in /var/www/html/api/dev/v1.0/vendor/mongodb/mongodb/src/Collection.php on line 187
unable to track where the issue is.
Looking forward to your help
Thanks,
Gulab Pasha
Jeremy Mikola
unread,
Sep 27, 2016, 10:34:33 AM9/27/16
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to mongod...@googlegroups.com
The root error is "Failed connecting to 'localhost:27017': Permission denied", which appears after the generic message that server selection has failed (i.e. "No suitable servers found"). FYI: "serverselectiontryonce set" is just reporting the selection mode of libmongoc that the PHP driver uses (we try once because we do not have a thread for background monitoring).
"Failed connecting to 'localhost:27017': Permission denied" is a networking issue below the driver. Firewall settings on the local machine might also be a possible cause.
Some cursory searching on "permission denied connect error" mostly turns up support forums for Java applications, but more than a handful of posts indicated some IPv6 and IPv4 issue. It's possible that PHP is resolving "localhost" to an IPv6 address. On the off chance that is a problem, changing the connection URI to use an explicit IP address (e.g. "mongodb://127.0.0.1") may help.