URGENT LDAP help

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
potato_chip
Forum Newbie
Posts: 20
Joined: Mon Oct 06, 2008 10:38 am

URGENT LDAP help

Post by potato_chip »

~pickle | Please use [ code=html ], [ code=php ], etc tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: :arrow: Posting Code in the Forums to learn how to do it too.


I have a really simple question on LDAP bind. I just want to try the anonymous bind to the AD controller, but the bind failed. Is there something wrong with configuration???? HELP REALLY NEEDED!

Here is my simple code:

Code: Select all

?php
 
//using ldap bind anonymously
 
$host = 'ldaps://123.45.67.89/'; //the IP address of AD controller
  
$ldapconn = ldap_connect($host)
    or die("Could not connect to LDAP server.");
 
if ($ldapconn) 
{
    // binding anonymously
    $ldapbind = ldap_bind($ldapconn);
 
    // verify binding
    if ($ldapbind) 
    {
        echo "LDAP bind successful...<br />";    
    } 
    else 
    {
        echo "LDAP bind failed...";
    }
}
 
?>
And here is the error message:
Warning: ldap_bind() [function.ldap-bind]: Unable to bind to server: Can't contact LDAP server in C:\wamp\virtual\wga\itest2\www\ldapConnect\abind.php on line 14
LDAP bind failed...


~pickle | Please use [ code=html ], [ code=php ], etc tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: :arrow: Posting Code in the Forums to learn how to do it too.
Post Reply