I'm trying to connect to AD. But the error is displayed:
Warning: ldap_connect (): Could not create session handle: Bad parameter to an ldap routine in C: \ Program Files (x86) \ EasyPHP-DevServer-14.1VC9 \ data \ localweb \ my portable files \ ad \ php on line 8 Could not connect to LDAP server.
Would anyone know the possible causes for this connection failure?
<?php
$ldap_server = "192.168.2.1/nomeservidor";
$dominio = "DOMINIO/";
$user = $dominio."administrador";
echo $user;
$ldap_porta = "389";
$ldap_pass = "minhasenha";
$ldapcon = ldap_connect($ldap_server, $ldap_porta) or die("Could not connect to LDAP server.");
if ($ldapcon) {
$bind = ldap_bind($ldapcon, $user, 'minhaSenha');
if ($bind) {
echo "LDAP bind successful…";
}
else {
echo "LDAP bind failed…";
}
}
?>
Thank you in advance.