By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,395 Members | 2,541 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,395 IT Pros & Developers. It's quick & easy.

unable to connect to active directory server

P: n/a
I'm trying to connect to an Active Directory server 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 [1] 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?

[1] http://www.microsoft.com/technet/sys...dexplorer.mspx
Jul 31 '08 #1
Share this Question
Share on Google+
3 Replies


P: n/a
yawnmoth <te*******@yahoo.comwrote:
I'm trying to connect to an Active Directory server 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 [1] 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?

[1] http://www.microsoft.com/technet/sys...dexplorer.mspx
Can you run Wireshark on the two sets of transactions
and post the (sanitized) traces?

Aug 2 '08 #2

P: n/a
On Aug 1, 7:42*pm, Charles Polisher <cpol...@nonesuch.comwrote:
yawnmoth <terra1...@yahoo.comwrote:
I'm trying to connect to an Active Directory server 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 [1] *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?
[1]http://www.microsoft.com/technet/sysinternals/networking/adexplorer.mspx

Can you run Wireshark on the two sets of transactions
and post the (sanitized) traces?
I actually figured it out - Active Directory Explorer automatically
appends the domain name to the username (eg. us**@domain.tld), whereas
PHP, I guess, doesn't, and instead, requires you manually add it.
Aug 4 '08 #3

P: n/a
I was having the same issues when trying to use the ldap functions in
PHP so I created a class that utilizes ADSI instead of LDAP. You can
grab it here http://www.phpclasses.org/browse/package/4549.html. I
found that utilizing COM & ADSI made the whole thing alot easier.

On Jul 31, 4:42*pm, yawnmoth <terra1...@yahoo.comwrote:
I'm trying to connect to an Active Directory server 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 [1] *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?

[1]http://www.microsoft.com/technet/sysinternals/networking/adexplorer.mspx
Aug 5 '08 #4

This discussion thread is closed

Replies have been disabled for this discussion.