最近我遇到了同樣的問題,發現this post。顯然,密碼修改被認爲是管理密碼重置,您必須指定AD以應用其規則的其他選項。
根據帖子,該控件必須在服務器上可用。這是目前在Windows Server 2008 R2的Service Pack 1,可以使用此修補程序安裝在2008 R2:
$ctrl1 = array(
// LDAP_SERVER_POLICY_HINTS_OID for Windows 2012 and above
"oid" => "1.2.840.113556.1.4.2239",
"value" => sprintf("%c%c%c%c%c", 48, 3, 2, 1, 1));
$ctrl2 = array(
// LDAP_SERVER_POLICY_HINTS_DEPRECATED_OID for Windows 2008 R2 SP1 and above
"oid" => "1.2.840.113556.1.4.2066",
"value" => sprintf("%c%c%c%c%c", 48, 3, 2, 1, 1));
if (!ldap_set_option($ds, LDAP_OPT_SERVER_CONTROLS, array($ctrl1, $ctrl2))) {
error_log("ERROR: Failed to set server controls");
}
$result = ldap_mod_replace($ds, $dn, $entry);
非常感謝:http://support.microsoft.com/?id=2386717
然後你發佈你的PHP代碼的修改命令之前配置選項給作者bmaupin(找不到他/她的名字)。 我決定回答這個問題,因爲我在尋找解決相同問題的解決方案時登陸了這裏。
非常好的解釋,謝謝! – 2012-08-10 15:04:18