WUGNET, the Windows User Group Network
Your Complete Resource Center for "The Best" in Shareware, Computing Tips and Support, Windows Industry News... and much more!
Home Forums Shareware Windows Tips Hot Offers FREE Newsletters Arcade Contact Us About Partners
Search WUGNET: RSS Feeds RSS Feeds Advertise with WUGNET    |    Shareware eBooks
HomeHome FAQFAQ      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

unable to connect to active directory server

 
   Home -> Windows Other -> Active Directory RSS
Next:  how to block ultrasuf in my domain  
Author Message
yawnmoth

External


Since: Aug 01, 2008
Posts: 6



(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?
Back to top
Login to vote
Ace Fekay [MVP]

External


Since: Mar 29, 2006
Posts: 554



(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.

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
Back to top
Login to vote
Brandon McCombs

External


Since: Sep 26, 2005
Posts: 87



(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.
Back to top
Login to vote
yawnmoth

External


Since: Aug 01, 2008
Posts: 6



(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.

That worked - thanks!
Back to top
Login to vote
Display posts from previous:   
       Home -> Windows Other -> Active Directory 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
Categories:
 Windows XP
 Windows Vista
  Windows Other
 Office
 Office Other
 Security
 WinRAR
  • Home |
  • Shareware |
  • Windows Tips |
  • Hot Offers |
  • FREE Newsletters |
  • Arcade |
  • Forums |
  • eBooks |
  • About WUGNET |
  • Partners |
  • Contact

  • WUGNET Privacy Policy |
  • Link to WUGNET