PHP 讀取 LDAP

PHP LDAP  
在 Windows 系統 裡面  無法修改密碼 因為 不提供 密碼儲存在 AD 上

[更改密碼]
ldap_modify_batch
You can't change your Active Directory password with PHP using ldap_mod_replace, you must use ldap_modify_batch if you are not an administrator.


$dn = "cn=Jack Smith-Jones,ou=Wizards,dc=example,dc=com";
$modifs = [
[
"attrib" => "userPassword",
"modtype" => LDAP_MODIFY_BATCH_REMOVE,
"values" => [“Tr0ub4dor&3”],
],
[
"attrib" => "userPassword",
"modtype" => LDAP_MODIFY_BATCH_ADD,
"values" => [“correct horse battery staple”],
],
];
ldap_modify_batch($connection, $dn, $modifs);

$entry[“unicodePwd”] = iconv("UTF-8", "UTF-16LE", '"' . $newPassword . '"');
4th: For changing password you can't use modify instead you should use mod_replace function.
ldap_mod_replace($ldapConnection, $user_dn, $entry)

https://php.net/ldap-modify-batch