ID: 30670
Comment by: peter dot burden at gmail dot com
Reported By: michael dot siebke at keymile dot com
Status: Open
Bug Type: LDAP related
Operating System: Linux (Redhat 8)
PHP Version: 5.0.1
New Comment:
PHP 4.3.10 + Apache 2.0.45 + Solaris 2.7 + Openldap 2.1.30
No problems using LDAP this way via a WWW server launched
script but the extra option settings described by Paul
Boven were necessary when using PHP CLI.
Previous Comments:
------------------------------------------------------------------------
[2005-01-13 00:12:15] p dot boven at chello dot nl
Hi,
This is not a PHP bug imho: the problem is that Windows 2003 -must-
have some options set between the ldap_connect and ldap_bind:
$ldap = ldap_connect($ldap_url);
...
ldap_set_option($ldap, LDAP_OPT_PROTOCOL_VERSION,3);
ldap_set_option($ldap, LDAP_OPT_REFERRALS,0);
...
ldap_bind($ldap, $ldap_user, $ldap_passwd)
Works fine for me with PHP 4.3.x, Solaris 9 (Sparc), ADS W2k3.
Regards, Paul Boven.
------------------------------------------------------------------------
[2004-11-03 09:03:58] michael dot siebke at keymile dot com
Description:
------------
It's not possible to search a Windows 2003 active directory using the
LDAP interface (Windows 2000 works fine). However, using other tools
(like LDAP browers), searching the Windows 2003 directory works. The
problems occurs only using the PHP library.
Reproduce code:
---------------
$connect = ldap_connect("[i]server.domain.de[/i]");
if ($connect != FALSE) {
$res = ldap_bind($connect, "[i]username[/i]",
"[i]password[/i]");
if ($res == FALSE) {
echo "Unable to bind to LDAP server<br>";
exit;
}
$attributes = array("sAMAccountName", "dn", "mail");
$data = ldap_search($connect, "[i]DC=company,DC=de[/i]",
"(sAMAccountName=[i]targetaccount[/i])");
if ($data != FALSE) {
echo "Reading data...<br>";
$data = ldap_get_entries($connect, $data);
} else {
echo "Nothing :-(<br>";
}
ldap_close($connect);
}
Expected result:
----------------
"Reading data..."
Actual result:
--------------
Warning: ldap_search() [function.ldap-search]: Search: Operations error
in /data/htdocs/hd5dev/Test.php on line 57
Nothing :-(
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=30670&edit=1