Owncloud 9 not connecting to AD LDAPS

Nothing I do will connect my OC 9 server to AD LDAPS, I have had this same issue since server version 8 and today after upgrading to latest stable same issues

Steps to reproduce

  1. Login as Admin user
  2. goto admin/LDAP section
  3. enter server info, user, password and click test base DN

Expected behaviour
connecting to my AD server should show a green tab at top

Actual behaviour
always get a yellow message that says lost connection to LDAP server
I can telnet from the OC server to my LDAPS server and it has a valid cert on it for LDAPS

Server configuration
Operating system: Ubuntu 14
Web server: Apache
Database: Mysql
PHP version: 5.5.9-1ubuntu4.21
ownCloud version (see ownCloud admin page): 9.0.8 stable
Updated from an older ownCloud or fresh install: upgraded from 8 but LDAP did not connect then either
Special configuration (external storage, external authentication, reverse proxy, server-side-encryption):

ownCloud log (data/owncloud.log)
here is a tail of the log

{“reqId”:“2Y5iptyaoPVKQKk0Ok+8”,“remoteAddr”:“x.x.x.x”,“app”:“user_ldap”,“message”:“Wiz: Attemping to Bind “,“level”:0,“time”:“2017-04-19T21:40:39+00:00”,“method”:“POST”,“url”:”/owncloud/index.php/apps/user_ldap/ajax/wizard.php”,“user”:“someusername”}
{“reqId”:“2Y5iptyaoPVKQKk0Ok+8”,“remoteAddr”:“x.x.x.x”,“app”:“PHP”,“message”:“ldap_bind(): Unable to bind to server: Can’t contact LDAP server at /var/www/owncloud/apps/user_ldap/lib/ldap.php#254”,“level”:3,“time”:“2017-04-19T21:40:39+00:00”,“method”:“POST”,“url”:“/owncloud/index.php/apps/user_ldap/ajax/wizard.php”,“user”:“someusername”}
{“reqId”:“2dNoYVbpN5Zzd6vSDWBC”,“remoteAddr”:“x.x.x.x”,“app”:“user_ldap”,“message”:“Turned off SSL certificate validation successfully.”,“level”:0,“time”:“2017-04-19T21:40:39+00:00”,“method”:“POST”,“url”:“/owncloud/index.php/apps/user_ldap/ajax/testConfiguration.php”,“user”:“someusername”}
{“reqId”:“7M00GbslbPegtEEYIeXF”,“remoteAddr”:“x.x.x.x”,“app”:“user_ldap”,“message”:“Count filter: objectclass=*”,“level”:0,“time”:“2017-04-19T21:41:50+00:00”,“method”:“POST”,“url”:“/owncloud/index.php/apps/user_ldap/ajax/wizard.php”,“user”:“someusername”}
{“reqId”:“7M00GbslbPegtEEYIeXF”,“remoteAddr”:“x.x.x.x”,“app”:“user_ldap”,“message”:“Turned off SSL certificate validation successfully.”,“level”:0,“time”:“2017-04-19T21:41:50+00:00”,“method”:“POST”,“url”:“/owncloud/index.php/apps/user_ldap/ajax/wizard.php”,“user”:“someusername”}
{“reqId”:“605XLoc8yqwuQLG6JpFf”,“remoteAddr”:“x.x.x.x”,“app”:“PHP”,“message”:“ldap_bind(): Unable to bind to server: Can’t contact LDAP server at /var/www/owncloud/apps/user_ldap/lib/ldap.php#254”,“level”:3,“time”:“2017-04-19T21:46:10+00:00”,“method”:“POST”,“url”:“/owncloud/index.php/apps/user_ldap/ajax/wizard.php”,“user”:“someusername”}
{“reqId”:“605XLoc8yqwuQLG6JpFf”,“remoteAddr”:“x.x.x.x”,“app”:“PHP”,“message”:“ldap_bind(): Unable to bind to server: Can’t contact LDAP server at /var/www/owncloud/apps/user_ldap/lib/ldap.php#254”,“level”:3,“time”:“2017-04-19T21:46:10+00:00”,“method”:“POST”,“url”:“/owncloud/index.php/apps/user_ldap/ajax/wizard.php”,“user”:“someusername”}
{“reqId”:“605XLoc8yqwuQLG6JpFf”,“remoteAddr”:“x.x.x.x”,“app”:“PHP”,“message”:“ldap_bind(): Unable to bind to server: Can’t contact LDAP server at /var/www/owncloud/apps/user_ldap/lib/ldap.php#254”,“level”:3,“time”:“2017-04-19T21:46:10+00:00”,“method”:“POST”,“url”:“/owncloud/index.php/apps/user_ldap/ajax/wizard.php”,“user”:“someusername”}
{“reqId”:“605XLoc8yqwuQLG6JpFf”,“remoteAddr”:“x.x.x.x”,“app”:“PHP”,“message”:“ldap_bind(): Unable to bind to server: Can’t contact LDAP server at /var/www/owncloud/apps/user_ldap/lib/ldap.php#254”,“level”:3,“time”:“2017-04-19T21:46:10+00:00”,“method”:“POST”,“url”:“/owncloud/index.php/apps/user_ldap/ajax/wizard.php”,“user”:“someusername”}
{“reqId”:“605XLoc8yqwuQLG6JpFf”,“remoteAddr”:“x.x.x.x”,“app”:“PHP”,“message”:“ldap_bind(): Unable to bind to server: Can’t contact LDAP server at /var/www/owncloud/apps/user_ldap/lib/ldap.php#254”,“level”:3,“time”:“2017-04-19T21:46:10+00:00”,“method”:“POST”,“url”:“/owncloud/index.php/apps/user_ldap/ajax/wizard.php”,“user”:“someusername”}

Please paste possible errors in the following code block, see How to find webserver or OC logfile / enable php logfile for more info

Integrity status for oC9+

Login as admin user into your ownCloud and access
http://example.com/index.php/settings/integrity/failed
no errors found

A has the same trouble, and can’t understand whats wrong ? Are somebody found solution ?

Wow I guess nobody actually uses LDAP or AD…

The question is: how is your ldap configured? Using right port?
Hard to tell from missing information.

ITs an AD server, I have a valid cert on it and I have tried both 636 and 389, I use this same server for other auth projects so I know it works.
The fact that the PHP script errors and says cannot connect is troubling…

Can you try this comment ownCloud Central ?