Using ldaps on port 636 or ldap on 389 but ldap config option ldapTLS is always zero?

Nextcloud version (eg, 12.0.2): 15.0.11
Operating system and version (eg, Ubuntu 17.04): Raspbian GNU/Linux 9 (stretch)
Apache or nginx version (eg, Apache 2.4.25): Apache/2.4.25 (Raspbian)
PHP version (eg, 7.1): 7.0.33-0+deb9u3

The issue you are facing:

I have set up an LDAP server and successfully connected. However when I run

php occ ldap:show-config

It shows the following:

| ldapTLS | 0

I am connecting using the ldaps:// on port 636 (is an attempt to ensure a secure connection is used). However, I get the same result if I use the url without daps:// on port 389.

Does this mean the connection is not secure? How can I ensure passwords are not transferred to the LDAP directory in clear text?

I have verified that the server has a valid ssl certificate by doing

openssl s_client -connect <ldapurl>:636 -showcerts </dev/null 2>/dev/null | openssl x509 -outform PEM > ad_ldap_server.pem

and successfully getting the certificate.

Is this the first time you’ve seen this error? (Y/N): Y (first time setting up LDAP)