The server does not want to execute. LDAP in PHP

I always get this error

The server does not want to execute

and my code is as follows:

   echo "Checking ...";
    $username = $_POST["username"];
    $passwd = $_POST["passwd"];
    $host              = 'myhost.co.uk'; 
    $port              = 389; 
    $dn                = 'uid='.$username.',cn=nssproxy,ou=users,dc=co,dc=uk';

   // conexion a ldap

    $conn = ldap_connect( "ldap://".$host.":389") ;

    ldap_set_option($conn, LDAP_OPT_PROTOCOL_VERSION, 3);
    ldap_set_option($conn, LDAP_OPT_REFERRALS, 0);

    // match de usuario y password
    $bind = ldap_bind( $conn, $dn, $password );


    if ($bind){
        echo "OK";
    }
    else {
        echo "NO OK";
    }
    echo ldap_error($conn);

Why do I have such an error? I always test any user, this script returns the same error.

Thanks in advance.

+5
source share
2 answers

So, I searched Google for Server is unwilling to perform, and the first result says:

P .1.4. ldap_ *: the server does not want to execute

slapd will return an unwillingness to execute an error if the backend containing the target record does not support this operation.

The password backend is only ready to search. It will return a reluctance to perform an error for all other operations.

. , , . ..

ldap_mod_replace() [function.ldap-mod-replace]: : ,

+4

- , ... /etc/ldap.conf binddn rootbinddn, .

0

Source: https://habr.com/ru/post/1529218/


All Articles