I have created a basic ldap query and connection using PHP and ldap_connect function. No records are returned from the query.
Here is the sample code:
<?php
$surname = "C";
$ldaphost = "scorpius"; // your ldap servers
$ldapport = 389; // your ldap server's port number
// Connecting to LDAP
$ds = ldap_connect( $ldaphost, $ldapport )
or die( "Could not connect to {$ldaphost}" );
if ($ds) {
$r = ldap_bind($ds); // this is an "anonymous" bind,
$dn = "DC=sr,DC=org";
$sr = ldap_search($ds, $dn, "sn=$surname*"
$info = ldap_get_entries($ds, $sr);
echo $info["count"];
?>
One of two things happen: a) no records are returned like it is above and the web page stays in a 'loading' state and never returns anything b)if I change the $dn variable slightly, the page does return but with zero records.
I have gone to the Active Directory server and verified all the data is correct. The Base DN exactly matches the value in my php script.
Any ideas on what the problem is? I know it shouldn't be this difficult. Is there anything I can do to diagnose where the problem is?
TIA!
Here is the sample code:
<?php
$surname = "C";
$ldaphost = "scorpius"; // your ldap servers
$ldapport = 389; // your ldap server's port number
// Connecting to LDAP
$ds = ldap_connect( $ldaphost, $ldapport )
or die( "Could not connect to {$ldaphost}" );
if ($ds) {
$r = ldap_bind($ds); // this is an "anonymous" bind,
$dn = "DC=sr,DC=org";
$sr = ldap_search($ds, $dn, "sn=$surname*"
$info = ldap_get_entries($ds, $sr);
echo $info["count"];
?>
One of two things happen: a) no records are returned like it is above and the web page stays in a 'loading' state and never returns anything b)if I change the $dn variable slightly, the page does return but with zero records.
I have gone to the Active Directory server and verified all the data is correct. The Base DN exactly matches the value in my php script.
Any ideas on what the problem is? I know it shouldn't be this difficult. Is there anything I can do to diagnose where the problem is?
TIA!