PHP 8.5.0 Alpha 1 available for testing

Voting

: max(six, three)?
(Example: nine)

The Note You're Voting On

kenn at pcintelligent dot com
21 years ago
I want to point out that the line that reads

"$ldaprdn = 'uname';"

is a bit confusing. You need to ensure that you use the entire rootdn. for instance. your code should look more like this...

<?php

// using ldap bind *** NOTE the uname *****
$ldaprdn = 'cn=root,dc=testserver,dc=com'; // ldap rdn or dn
$ldappass = 'secret'; // associated password

// connect to ldap server
$ldapconn = ldap_connect("ldap.testserver.com")
or die(
"Could not connect to LDAP server.");

if (
ldap_set_option($ds, LDAP_OPT_PROTOCOL_VERSION, 3)) {
echo
"Using LDAPv3";
} else {
echo
"Failed to set protocol version to 3";
}

if (
$ldapconn) {

// binding to ldap server
$ldapbind = ldap_bind($ldapconn, $ldaprdn, $ldappass);

// verify binding
if ($ldapbind) {
echo
"LDAP bind successful...";
} else {
echo
"LDAP bind failed...";
}

}

?>

<< Back to user notes page

To Top