1
votes

I am trying to check if a user exists in AD using ldap in php. Please note that I am not trying to authenticate, only sort of validating a username..

I call ldap_bind without username or password credentials, meaning I am binding anonymously. However, whenever I call ldap_search, it returns a 500 -Internal Server Error, and on checking my dev.log file, I find that a kernel.exception was thrown.

When I use a username&password combination the call to ldap_bind, it works. However this is not what I am trying to do. The username I will be verifying will not be coming along with a password eventually.

How can I possibly get ldap_search when ldap_bind has been called anonymously?

I am using that Symfony2 framework, and thanks, in advance.

you know that there is a Symfony-Bundle for Zend\Ldap? It might make your Life easier. - heiglandreas
Everywhere I checked, everyone was only pointing out how support for such anonymous binds has been phased out since Windows Server 2003 as clearly spelt out in this kb article here. So, I simply accepted that this is the way how, and found credentials I could use. I still think/hope there is another way though. - paulatumwine
I'm not sure on what you want to accomplish. Do you want to authenticate users against the AD? Then they will need a password! But to check for the user BEFORE verifying the password you will need another user on AD to bind to. So basically you bind to AD twice. Once as known user to do an ldap_search for the authenticating user and then a second bind using the retrieved DN of the authenticating user with the supplied password. Or did I get something wrong? - heiglandreas