Jump to content

Archived

This topic is now archived and is closed to further replies.

ale1981

PHP and LDAP

Recommended Posts

Using Apache2, PHP5 I keep get the following error. I am new to LDAP and PHP so please bare with me!

[code]
    $dn = "DN=LoftingConsultingLtd, DN=local";

    $attributes = array("displayname", "l");

    $filter = "(cn=*)";

    $ad = ldap_connect("localhost")
          or die("Couldn't connect to AD!");
  
    ldap_set_option($ad, LDAP_OPT_PROTOCOL_VERSION, 3);

    $bd = ldap_bind($ad,"int-admin@LoftingConsultingLtd.local","password")
          or die("Couldn't bind to AD!");

    $result = ldap_search($ad, $dn, $filter, $attributes);

    $entries = ldap_get_entries($ad, $result);

    for ($i=0; $i<$entries["count"]; $i++)
    {
        echo $entries[$i]["displayname"]
             [0]."(".$entries[$i]["l"][0].")<br />";
    }

    ldap_unbind($ad);
[/code]

[code]
Warning: ldap_search() [function.ldap-search]: Search: Operations error in C:\www\loftingconsulting\public_html\test.php on line 22

Warning: ldap_get_entries(): supplied argument is not a valid ldap result resource in C:\www\loftingconsulting\public_html\test.php on line 24
[/code]

Any ideas??? Is driving me bonkers! :confused:

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.