Home > Archive > PHP Language > November 2005 > PHP and Active Directory
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
PHP and Active Directory
|
|
| andyt_2000_uk@yahoo.co.uk 2005-11-27, 6:56 pm |
| Hi
I'm trying to get it so visitors to our intranet site are able to log
into the site with there normal login details. On a network using
win2k3, active directory etc.
Now my code at the moment seems to connect to AD but it fails when it
trys to bind.
<?php
//Connect to Active Directory
$ad = ldap_connect("hole.chase.local, 389") or
die("Couldn't connect to AD!"."<br />");
echo "connect result is " . $ad . "<br />";
//set protocol version
if (ldap_set_option($ds, LDAP_OPT_PROTOCOL_VERSION, 3)) {
echo "Using LDAPv3". "<br />";
} else {
echo "Failed to set protocol version to 3";
}
$ldaprdn = 'andy';
$ldappass = 'password';
//Bind to Active Directory
if ($ad){
$bd = ldap_bind($ad, $ldaprdn, $ldappass) or
die("Couldn't bind to AD!");
}
if ($bd){
echo "success"."<br />";
} else {
echo "fail"."<br />";
}
?>
Everytime it runs it dies, saying Couldn't bind to AD!
Checking the logs for apache i notice it reports
[client 127.0.0.1] PHP Warning: ldap_bind(): Unable to bind to
server: Can't contact LDAP server in F:\\Website\\htdocs\\example3.php
on line 23
Any ideas on how to solve this would be great.
Cheers
Andy
| |
| ZeldorBlat 2005-11-27, 9:55 pm |
| Why even bother with all that? Just enable Windows authentication in
IIS and use the $_SERVER variables to get the username.
| |
| Centurion 2005-11-28, 3:55 am |
| ZeldorBlat wrote:
> Why even bother with all that? Just enable Windows authentication in
> IIS and use the $_SERVER variables to get the username.
Because most of the world runs apache and some of us (ok, maybe just me) are
interested in implementing the same sort of functionality to bind non-MS
web application's authentication to AD :)
<FLAME_BAIT>
IIS really is a poor excuse for a web server.
</FLAME_BAIT>
Cheers,
James
--
The Tree of Learning bears the noblest fruit, but noble fruit tastes bad.
| |
| andyt_2000_uk@yahoo.co.uk 2005-11-28, 7:55 am |
| Were not using IIS thats why.
Anyone else have any ideas?
|
|
|
|
|