potato_chip Posted October 8, 2008 Share Posted October 8, 2008 I'm new to PHP/LDAP. And tried to use LDAP bind function:ldap_bind(). The weird thing is if I use anonymous bind, it shows: LDAP bind successful... However, if I give my credentials (my username and password), it always display warning message: Warning: ldap_bind() [function.ldap-bind]: Unable to bind to server: Inv alid credentials in C:\wamp\virtual\wga\itest2\www\ldapConnect\bindTest.php on line 13 LDAP bind failed... Here is my very simple code: <?php $host = ''; //I provide the IP address of AD controller // using ldap bind $ldaprdn = ''; // ldap rdn or dn $ldappass = ''; // associated password $ldapconn = ldap_connect($host) or die("Could not connect to LDAP server."); if ($ldapconn) { // binding to ldap server $ldapbind = ldap_bind($ldapconn, $ldaprdn, $ldappass); // verify binding if ($ldapbind) { echo "LDAP bind successful...<br />"; } else { echo "LDAP bind failed..."; } } // all done? clean up ldap_close($ldapconn); ?> Can somebody tell me what's wrong? I also noticed when I check my phpinfo(), PHP Version 5.2.5, it shows: LDAP Support: enabled RCS Version: $Id: ldap.c,v 1.161.2.3.2.11 2007/07/17 09:09:42 jani Exp $ Total Links: 0/unlimited API Version: 2004 Vendor name: OpenLDAP Vendor Version: 0 WHY the vendor version is 0? Is than an error? if it is, is it due to the wrong configuration? What's the fix? Does this error caused my LDAP function not working properlly? Thanks, I'm really frustrated now. Link to comment https://forums.phpfreaks.com/topic/127612-phpldap-simple-question/ Share on other sites More sharing options...
potato_chip Posted October 8, 2008 Author Share Posted October 8, 2008 I'm new to PHP/LDAP. And tried to use LDAP bind function:ldap_bind(). The weird thing is if I use anonymous bind, it shows: LDAP bind successful... However, if I give my credentials (my username and password), it always display warning message: Warning: ldap_bind() [function.ldap-bind]: Unable to bind to server: Inv alid credentials in C:\wamp\virtual\wga\itest2\www\ldapConnect\bindTest.php on line 13 LDAP bind failed... Here is my very simple code: <?php $host = 'ldaps://172.20.10.43'; //I provide the IP address of AD controller // using ldap bind $ldaprdn = ''; // ldap rdn or dn $ldappass = ''; // associated password $ldapconn = ldap_connect($host) or die("Could not connect to LDAP server."); if ($ldapconn) { // binding to ldap server $ldapbind = ldap_bind($ldapconn, $ldaprdn, $ldappass); // verify binding if ($ldapbind) { echo "LDAP bind successful...<br />"; } else { echo "LDAP bind failed..."; } } // all done? clean up ldap_close($ldapconn); ?> Can somebody tell me what's wrong? I also noticed when I check my phpinfo(), PHP Version 5.2.5, it shows: LDAP Support: enabled RCS Version: $Id: ldap.c,v 1.161.2.3.2.11 2007/07/17 09:09:42 jani Exp $ Total Links: 0/unlimited API Version: 2004 Vendor name: OpenLDAP Vendor Version: 0 WHY the vendor version is 0? Is than an error? if it is, is it due to the wrong configuration? What's the fix? Does this error caused my LDAP function not working properlly? Thanks, I'm really frustrated now. Link to comment https://forums.phpfreaks.com/topic/127612-phpldap-simple-question/#findComment-660302 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.