PHP, LDAP and the root DSE

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi all,

We've been having fun and games using PHP to query an Active Directory
(Windows 2000) via the LDAP interface.  It's all been very successful and
we've got a whole load of ideas for various internal web based services all
hooked in to the AD.  The one thing that's got us stumped though, is how on
earth do you query the root DSE from PHP?  I can do it from the command line
using the OpenLDAP ldapsearch tool e.g.

ldapsearch  -x -h domcon -s base -b "" "objectClass=*"

Works a treat - it returns the the root DSE.  Try the same thing from PHP...

$ds=ldap_connect("ldap://domcon";);
ldap_set_option($ds, LDAP_OPT_PROTOCOL_VERSION, 3);
ldap_set_option($ds, LDAP_OPT_REFERRALS, 0);
ldap_bind($ds,"jsmith@mydomain.com","mypassword");
$sr=ldap_read($ds,"","objectClass=*");
echo ldap_count_entries($ds,$sr);
$info = ldap_get_entries($ds,$sr);
echo "<pre>";
print_r($info);
echo "</pre>";
ldap_close($ds);

... and you get nothing. :-( I can get at everything other than the root
DSE. A couple of things to note:
* Technically you don't actually need to bind with an AD server to get at
the root DSE (correct me if I'm wrong!)
* The PHP ldap_read function uses BASE as its search scope.

So has anybody managed to read the root DSE from PHP and if so how?!

(We're running PHP 4.3.2, Apache 1.3.20 and OpenLDAP 2.0.11 libraries on a
Red Hat 7.2 i386 box).

Dan.



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux