"Can't contact LDAP server (-1)" error for LDAPS to Server 2012

Solution 1:

This problem can occur because the TLS 1.2 implementation in Windows 2012 is incompatible with some versions of Linux libraries like gnutls.

If this is your problem, disabling TLS 1.2 will restore functionality. The following options may be available to you:

In Linux CLI (may need to escape the exclamation point, found here):

export LDAPTLS_CIPHER_SUITE=NORMAL:!VERS-TLS1.2

In PHP on Linux (found here and here):

putenv(‘LDAPTLS_CIPHER_SUITE=NORMAL:!VERS-TLS1.2’);

On Windows Server 2012, I can't find concise instructions, but these are the registry entries. Directly editing the registry can be dangerous so use with caution.