错误ldap无法联系php

时间:2018-03-13 02:37:39

标签: php ldap

我尝试过新代码,但仍然存在以下错误凭据无效

<?php
$username = "cwahyono";
$password = "1234";
$ldapconfig['host'] = '10.0.0.120';
$ldapconfig['port'] = '389';
$ldapconfig['basedn'] = 'dc=10,dc=0,dc=0,dc=120';
$ldapconfig['usersdn'] = 'cn=admin';
$ds=ldap_connect($ldapconfig['host'], $ldapconfig['port']);
ldap_set_option($ds, LDAP_OPT_PROTOCOL_VERSION, 3);
ldap_set_option($ds, LDAP_OPT_REFERRALS, 0);
ldap_set_option($ds, LDAP_OPT_NETWORK_TIMEOUT, 10);
$dn="uid=".$username.",".$ldapconfig['usersdn'].",".$ldapconfig['basedn'];
if ($bind=ldap_bind($ds, $dn, $password)) {
    echo "LOGIN BERHASIL!";
} else {
 echo "Login Failed: Please check your username or password";
}
?>

我是新手ldap请帮我解决这个问题

0 个答案:

没有答案