(Msg. 1) Posted: Fri Aug 01, 2008 5:34 am
Post subject: unable to connect to active directory server Archived from groups: microsoft>public>win2000>active_directory (more info?)
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?
(Msg. 2) Posted: Sat Aug 02, 2008 12:43 am
Post subject: Re: unable to connect to active directory server [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
In news:7e3f2cba-181a-48fc-992c-9fc5222bca39@27g2000hsf.googlegroups.com,
yawnmoth <terra1024.TakeThisOut@yahoo.com> typed:
> 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 (username@domain.com). See if either one works.
--
Regards,
Ace
This posting is provided "AS-IS" with no warranties or guarantees and
confers no rights.
(Msg. 3) Posted: Sun Aug 03, 2008 6:31 pm
Post subject: Re: unable to connect to active directory server [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
yawnmoth wrote:
> 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?
ADS requires that you tell it what domain your account resides in. It
won't assume the obvious even if you only have one domain. So do what
Ace said, specify the UPN and it should work. In my Java-based LDAP GUI
that I created I inform users to specify their username in UPN format
and it works just fine.
(Msg. 4) Posted: Mon Aug 04, 2008 12:07 pm
Post subject: Re: unable to connect to active directory server [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
On Aug 1, 11:43 pm, "Ace Fekay [MVP]" <PleaseAs....DeleteThis@SomeDomain.com>
wrote:
> Innews:7e3f2cba-181a-48fc-992c-9fc5222bca39@27g2000hsf.googlegroups.com,yawnmoth<terra1....DeleteThis@yahoo.com> typed:
>
>
>
> > 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 (usern...@domain.com). See if either one works.
All times are: Eastern Time (US & Canada) (change)
Page 1 of 1
You can post new topics in this forum You can reply to topics in this forum You can edit your posts in this forum You can delete your posts in this forum You can vote in polls in this forum