Hello all,
I'n new in this forum, so I would like to introduce myself. I work in barcelona as oracle dba, and... any times I install open ldap. But I do not have much experience so the last open ldap I install was, copying and pasting commands from a web site. The ldpa works but I have a dubt.

I'll paste here 2 codes, one works and the other do not works, I guess it's because my ldap server is configured to connect without binding.

This the code working fine:

 // specify the LDAP server to connect to
 $conn = ldap_connect("localhost") or die("Could not connect to server");

 // bind to the LDAP server specified above
 $r = ldap_bind($conn) or die("Could not bind to server");

 // create the search string
 $query = "(uid=" . $_POST['login'] . ")";
****** HERE THE POST login is mbvale*************

 $result=ldap_search($conn,"dc=orex,dc=es", $query) or die ("Error in search query");
 // get entry data as array
 $info = ldap_get_entries($conn, $result);

 for ($i=0; $i<$info["count"]; $i++){
        if($pass!=rtrim($info[$i]["userpassword"][0]," ")){
                header("Location: http://opac.orex.es:8081/admin_orex/orex_login.php");
                header("Location: http://opac.orex.es:8081/admin_orex/orex_admin.php");
And this is the code that in NOT working:

$info = ldap_get_entries($ldapConnection, $ldapSearch);
        if ($info['count']) {
            // Validate the user credentials by attempting to bind to LDAP:
            $ldapBind = ldap_bind(
                $ldapConnection, $info[0]['dn'], $this->_password
            if ($ldapBind) {
                // If the bind was successful, we can look up the full user info:
                $ldapSearch = ldap_search(
                    $ldapConnection, $ldapConnectionParameter['basedn'], $ldapFilter
                $data = ldap_get_entries($ldapConnection, $ldapSearch);
                return $this->_processLDAPUser($data, $ldapConnectionParameter);
        echo var_dump($info[0]['dn']);
        echo var_dump($data);
        echo ldap_error() . " -auth1";
        return new PEAR_ERROR('authentication_error_invalid');
As I can see, the first code just look to the user and check if password field is filled or not, and the second code need the password. I need both code to work, what must I check in the ldap config to get it working??

Thanks for all the help you can give.