Jump to content

PHP/LDAP simple question


potato_chip

Recommended Posts

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

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.