I have the PHP code in LDAP to change password in Active Directory:
<?php
$usuario="xxx";
$senha_atual="0000";
$senha_nova="11111";
$pessoas="casa.cafe.br";
$servidor="1.1.1.1";
$porta=389;
$portas=636;
$base="CN=$usuario,CN=Users,DC=casa,DC=cafe,DC=br";
$rdn=$usuario."@".$pessoas;
$con = @ldap_connect("ldap://".$servidor, $portas) or die("Erro na conexao ao servidor {$servidor}");
if ($con) {
ldap_set_option($con, LDAP_OPT_PROTOCOL_VERSION, 3);
ldap_set_option($con, LDAP_OPT_REFERRALS, 0);
$bind = ldap_bind($con, $rdn, $senha_atual);
echo "Passou do ldap_bind($con, $usuario."@".$pessoas, $senha_atual);";
// verify binding
if ($bind) {
$userdata["mail"] = "[email protected]";
$userdata["unicodepwd"] = iconv( 'UTF-8', 'UTF-16LE', "\"".$senha_nova."\"" );
echo "<pre>";
var_dump($userdata);
echo "</pre>";
$rs = ldap_modify($con, $base, $userdata);
echo "<br><br>";
ldap_get_option($con,LDAP_OPT_ERROR_STRING,$error);
echo $error;
echo "<br><br>";
if ($rs) {
$msg="Senha foi atualizada com sucesso!";
}else{
$msg="Ocorreu um erro ao trocar a senha! Contate o Administrador.";
}
} else {
$msg="Usuario inexistente ou senha incorreta! Tente novamente.";
}
}
?>
When I try to change the user password it shows the following message:
Warning: ldap_modify (): Modify: Server is unwilling to perform in
Using the code:
ldap_get_option($con,LDAP_OPT_ERROR_STRING,$error);
echo $error;
Show this message:
0000001F: SvcErr: DSID-031A129B, problem 5003 (WILL_NOT_PERFORM), date 0
Researching found solutions that say to be able to change the precise password of a PHP SSL connection with Windows AD, how can I configure PHP from my local machine running XAMPP and Windows AD to be able to connect via SSL ?
obs .: Using XAMPP with PHP Version 7.1.1 (Local Machine) and Windows Server 2012 (Network Server).