*<?php// LDAP variables//$ldaphost = "host";$ldaphost = "localhost";$ldapport = 389;//$ldap_base_dn = "dc=exemplo,dc=com";$ldap_base_dn = "dc=zyz,dc=com";//$ldaprdn = "cn=Manager,$ldap_base_dn";$ldaprdn = "cn=root,$ldap_base_dn";$ldappassw = "my_password";// Connecting to LDAP$ldapconn = ldap_connect($ldaphost, $ldapport) or die ("Could not connect to $ldaphost");@ldap_set_option($ldapconn, LDAP_OPT_PROTOCOL_VERSION, 3);if ($ldapconn) { // binding to ldap server $ldapbind = ldap_bind($ldapconn,$ldaprdn,$ldappassw); // verify binding if (!$ldapbind) { echo '<script>alert("not connected")</script>'; var_dump($ldapbind); exit(); } }?>*
Fail to bind, $ldapbind return bool(false). I have configured phpldapadmin, which is working fine.
Regards Abhishek Koserwal Final year, CSE, IET-DAVV
The capacity to learn is a gift; The ability to learn is a skill; The willingness to learn is a choice -- Brian Herbert
On Thu, 12 Feb 2015, Abhishek koserwal wrote:
<?php $ldaphost = "localhost";
[...]
$ldapbind = ldap_bind($ldapconn,$ldaprdn,$ldappassw);
[...]
Fail to bind, $ldapbind return bool(false). I have configured phpldapadmin, which is working fine.
0. http://php.net/manual/en/function.ldap-errno.php
1. Since $ldaphost is "localhost" perhaps you have sufficent access to run slapd with debugging enabled (e.g. start slapd with the -d argument). This can be quite illustrative. For example, perhaps you could compare debugging logs generated from the working phpldapadmin vs. your non-working snippet.
On Feb 12, 2015, at 7:53 AM, Abhishek koserwal abhishek.koserwal@gmail.com wrote:
...
Fail to bind, $ldapbind return bool(false). I have configured phpldapadmin, which is working fine.
I’m not a php expert but the first thing I would do is look in the openldap log to determine the cause of the bind error.
-morgan
openldap-technical@openldap.org