ldap_bind

Eléphanteau du PHP | 18 Messages

03 mars 2009, 14:27

Bonjour, j'arrive a me connecter sur mon serveur LDAP, mais je n 'arrive pas à faire le bind.
Je recois toujours l'erreur suivante:
Warning: ldap_bind() [function.ldap-bind]: Unable to bind to server: Protocol error in C:\wamp\www\Test\inc\function.inc.php on line 22

Voici le code de ma fonction
function login($user,$password){
		$server = "localhost";
		$port = 389;
		//$racine = "dc=my-domain,dc=com";
		$rootdn = 'cn=Manager,dc=my-domain,dc=com';
		$rootpw = 'secret';
		echo "Connexion...<br>";

		$ds=ldap_connect($server,$port);

		if ($ds!=FALSE)
		{    echo $ds;
			// on s'authentifie en tant que super-utilisateur
			$r=ldap_bind($ds,$rootdn,$rootpw);
			if ($r) {
				echo "Connexion LDAP réussie";
			} else {
				echo "Connexion LDAP échouée";
			}