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

Warning: ldap_bind(): Unable to bind to server: Can't contact LDAP Server

P: 2
I am trying to bind to an LDAP server using php without success. I have a linux server running php compiled with open ldap. I am using the following code taken right from php.net:
Expand|Select|Wrap|Line Numbers
  1. echo "<h3>LDAP query test</h3>"; 
  2. echo "Connecting ..."; 
  3. $ds=ldap_connect("ldap.berkeley.edu");  // must be a valid LDAP server! 
  4. echo "connect result is ".$ds."<p>"; 
  5.  
  6. if ($ds) { 
  7.     echo "Binding ..."; 
  8.     $r=ldap_bind($ds);     // this is an "anonymous" bind, typically 
  9.                            // read-only access 
  10.     echo "Bind result is ".$r."<p>"; 
I get a result from ldap_connect, but an error with ldap_bind. I get the following error:

Warning: ldap_bind() [function.ldap-bind]: Unable to bind to server: Can't contact LDAP server in /home/eric/public_html/academic-senate-test/authenticate/login_action.php on line 26

I can access ldap.berkeley.edu from other ldap browsers just fine. The php code is on a server separate from the ldap directory. Is there a specific way to compile php with ldap so that it knows to access a server that is not local, could this be the problem?

I have googled, found a fair number of people reporting this problem but no answers. I appreciate any advice, thanks!

Eric
Oct 8 '07 #1
Share this Question
Share on Google+
3 Replies


pbmods
Expert 5K+
P: 5,821
Heya, Eric. Welcome to TSDN!

Changed thread title to better describe the problem (did you know that threads whose titles do not follow the Posting Guidelines actually get FEWER responses?).

Please use CODE tags when posting source code:

[CODE=php]
PHP code goes here.
[/CODE]
Oct 9 '07 #2

P: 2
Thanks for the posting guidelines.

Here is the readout from phpinfo under the ldap section:

LDAP Support enabled
RCS Version $Id: ldap.c,v 1.161.2.3.2.11 2007/07/17 09:09:42 jani Exp $
Total Links 0/unlimited
API Version 3001
Vendor Name OpenLDAP
Vendor Version 20213

Appreciate any advice, thanks!

- Eric
Oct 9 '07 #3

Atli
Expert 5K+
P: 5,058
Heya, Eric. Welcome to TSDN!

Are you sure your LDAP server allows anonymous connections?
Try using the ldap_error() function to see if you can find any more details on the error.
Oct 9 '07 #4

Post your reply

Sign in to post your reply or Sign up for a free account.