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...
ldap_set_option($ds, LDAP_OPT_PROTOCOL_VERSION, 3);
ldap_set_option($ds, LDAP_OPT_REFERRALS, 0);
$info = ldap_get_entries($ds,$sr);
... 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).
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php