PHP and Active Directory

This is a discussion on PHP and Active Directory within the PHP General forums, part of the PHP Programming Forums category; Hi I'm trying to get it so visitors to our intranet site are able to log into the site ...


Go Back   Usenet Forums > PHP Programming Forums > PHP General

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 11-28-2005
andyt_2000_uk@yahoo.co.uk
 
Posts: n/a
Default PHP and Active Directory

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

Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 08:39 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0