unable to connect to active directory server

  • Thread starter Thread starter yawnmoth
  • Start date Start date
Y

yawnmoth

I'm trying to connect to an Active Directory server with PHP and am
having some
difficulties. Here's the code I'm using:

<?php
if (!($ldap = ldap_connect('domain.tld'))
{
exit('unable to connect');

}

ldap_bind($ldap, 'username', 'password');
?>

With that code, I get the following error:

Warning: ldap_bind() [function.ldap-bind]: Unable to bind to server:
Invalid credentials in C:\htdocs\test.php on line 10

The thing is... I can connect just fine using Active Directory
Explorer v1.01 using the same info as above. The only thing I
can figure is that Active Directory Explorer is doing something that
PHP doesn't. Maybe it connects to a different port than PHP does by
default? Maybe it appends something to the username?
 
In
yawnmoth said:
I'm trying to connect to an Active Directory server with PHP and am
having some
difficulties. Here's the code I'm using:

<?php
if (!($ldap = ldap_connect('domain.tld'))
{
exit('unable to connect');

}

ldap_bind($ldap, 'username', 'password');
With that code, I get the following error:

Warning: ldap_bind() [function.ldap-bind]: Unable to bind to server:
Invalid credentials in C:\htdocs\test.php on line 10

The thing is... I can connect just fine using Active Directory
Explorer v1.01 using the same info as above. The only thing I
can figure is that Active Directory Explorer is doing something that
PHP doesn't. Maybe it connects to a different port than PHP does by
default? Maybe it appends something to the username?

I'm not much of a scripter, so I can't really comment on the code, but one
thing I can suggest is try supplying the credentials as 'domain\username,'
or even the UPN ([email protected]). See if either one works.

--
Regards,
Ace

This posting is provided "AS-IS" with no warranties or guarantees and
confers no rights.

Ace Fekay, MCSE 2003 & 2000, MCSA 2003 & 2000, MCSE+I, MCT,
MVP Microsoft MVP - Directory Services
Microsoft Certified Trainer

For urgent issues, you may want to contact Microsoft PSS directly. Please
check http://support.microsoft.com for regional support phone numbers.

Infinite Diversities in Infinite Combinations
 
Intyped:


I'm trying to connect to an Active Directory server with PHP and am
having some
difficulties.  Here's the code I'm using:
<?php
if (!($ldap = ldap_connect('domain.tld'))
{
       exit('unable to connect');

ldap_bind($ldap, 'username', 'password');
With that code, I get the following error:
Warning: ldap_bind() [function.ldap-bind]: Unable to bind to server:
Invalid credentials in C:\htdocs\test.php on line 10
The thing is...  I can connect just fine using Active Directory
Explorer v1.01 using the same info as above.  The only thing I
can figure is that Active Directory Explorer is doing something that
PHP doesn't.  Maybe it connects to a different port than PHP does by
default?  Maybe it appends something to the username?

I'm not much of a scripter, so I can't really comment on the code, but one
thing I can suggest is try supplying the credentials as 'domain\username,'
or even the UPN ([email protected]). See if either one works.

That worked - thanks!
 
Back
Top