Jump to content


Photo

PHP and LDAP


  • Please log in to reply
1 reply to this topic

#1 ale1981

ale1981
  • Members
  • PipPipPip
  • Advanced Member
  • 65 posts

Posted 21 June 2006 - 09:36 AM

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

    $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);

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

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

#2 ale1981

ale1981
  • Members
  • PipPipPip
  • Advanced Member
  • 65 posts

Posted 21 June 2006 - 09:53 AM

Sorry, my error. Please close.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users