M
M
Maxim2019-10-10 12:11:09
PHP
Maxim, 2019-10-10 12:11:09

Why is php ldap returning 0 records?

tell me why with such a connection it gives 0 records, although there are records on the server

<?php
//Параметры подключения

$LDAP = array(
'server' => '217.107.193.59',
'port' => '389',
'user' => '[email protected]',
'pass' => '123$zxc',
'dn' => 'OU=epc,DC=epc,DC=local'
);
// Подключаемся к серверу
$adconn = ldap_connect($LDAP['server'], $LDAP['port'])
    or die('Не могу подключиться к LDAP-серверу 1');

// Устанавливаем версию протокола 
ldap_set_option($adconn, LDAP_OPT_PROTOCOL_VERSION, 3);

// Привязка
ldap_bind($adconn, $LDAP['user'], $LDAP['pass'])
or die('Не мего подключиться к LDAP серверу 11');

// выборка
$filter = "(sn=*)";
$att = array( "ou","userPrincipalName");

$result=ldap_search($adconn, $LDAP['dn'], $filter, $att);
if ($result) {
    $info = ldap_get_entries($adconn, $result);
    print $info["count"]." entries returned";
} else
    print "LDAP search error ".ldap_errno($adconn)." (".ldap_error($adconn).")";

ldap_close($adconn);

although the list of users
5d9ef91a8863a084965787.jpeg

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Rsa97, 2019-10-10
@Rsa97

OU=epc,DC=test,DC=epc,DC=local

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question