我正在编写 PHP 代码并尝试连接到 VMware View ADAM 数据库,但不幸的是没有成功。这是 LDAP 类型的数据库,类似于 Active Directory,但无法使其工作!连接到 ADAM 的用户是 Active Directory 域用户。
所以这里是代码:
private $ldap_server = "ldap://adam.domain.com";
private $auth_user = "UID=adam.read,OU=someOU,OU=ServiceAccs,DC=domain,DC=com";
private $auth_pass = "password";
$ADAMconnection=ldap_connect($this->ldap_server);
ldap_set_option ($ADAMconnection, LDAP_OPT_REFERRALS, 0);
ldap_set_option($ADAMconnection, LDAP_OPT_PROTOCOL_VERSION, 3);
if ($ADAMconnection) {
$r=ldap_bind($ADAMconnection, $this->auth_user, $this->auth_pass); // line 29
if($r)
{
echo "<p>Bind successful</p>";
}
else
{
echo "<p>Bind not successful</p>";
}
echo "<p> $r</p>";
}
这是我在第 29 行(绑定语句)得到的警告:
Warning: ldap_bind(): Unable to bind to server: Other (e.g., implementation specific) error
用户具有“读取”权限 - 我检查了 ADSIEdit。我也尝试用以下代码替换用户名,但仍然没有成功:
private $auth_user = "adam.read@domain.com";
编辑:忘了提到编程环境。