Jump to content

PHP LDAP


H46615

Recommended Posts

Hi,

 

I have two servers a Windows 2000 Server which servers my network and I have a Redhat Linux box which runs my intranet site.  Currently users log on to the intranet with a separate login.  I wish to connect to Active Directory on the Windows 200 Server from the Linux server.  Is it possible to connect to AD using PHP LDAP from a separate server.  I have PHP LDAP installed successfully on my server and have had a few attempts, which were unsucessful.  I have the following code so far:

 

$server="10.160.104.10";        //change to ip address of ldap server

//change to reflect the ou and domain that your users are in.
$basedn="ou=Establishments, ou=BHS, ou=System Administrators, dc=domain dc=internal";        

$username="admin";
$password="password";

$dn = "dn=$username, ";
if (!($connect = ldap_connect($server)))
{
  die ("Could not connect to LDAP server");
}
// code works until here
if (!($bind = ldap_bind($connect, "$dn" . "$basedn", $password))) 
{
  die ("Could not bind to $dn$basedn");
}

 

Can anyone help me with this problem or tell me where I am going wrong.  Thank you in advance.

Link to comment
https://forums.phpfreaks.com/topic/99504-php-ldap/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.