PHP and Active Diretory
Moderator: General Moderators
PHP and Active Diretory
I'm trying to incorporate Active Directory into PHP, has anyone done this before? Please post some tips. Thanks... 
Re: PHP and Active Diretory
You'll need to be more specific about what you want to accomplish.quadoc wrote:I'm trying to incorporate Active Directory into PHP, has anyone done this before? Please post some tips. Thanks...
Do you want pass through browser login using their domain credentials?
Do you want full access to the AD user information (not just pass/fail auth by username)?
Each are different. Also, which webserver are you using? It does make a difference here, as IIS will give you access to some of the above natively without any work in PHP. Also, is the machine that will host the code a trusted member of the domain? It will need to be for virtually *any* interaction with the AD.
Be more specific, and we can give more specific answers.
Okay, thats two different problems.quadoc wrote: And yes, I want want pass through browser login using their domain credentials and full access to the AD user information on IIS
The first one (pass thru browser login auth):
Configure the directory in IIS to NOT allow anonymous logins. This will force it to use one of the authenticated user types, and the defaults include IIS/AD authentication.
Then, and I'm not kidding, in your app you just need this:
Code: Select all
$loginstuff = explode("",$_SERVER['AUTH_USER']);
echo "Domain: " . $loginstuff[0];
echo "<br>";
echo "Username: " . $loginstuff[1];Now, the second problem is worlds different. It involves setting up AD to respond to LDAP requests, building a proper LDAP query string, using the php LDAP functions, and so on.
I suggest looking for a ready made package (library, class) for handling something that epic.