473,396 Members | 2,013 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

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

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
3 18686
pbmods
5,821 Expert 4TB
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
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
5,058 Expert 4TB
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

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

Similar topics

0
by: aiKeith | last post by:
Hello, Here is my situation. I have developed several apps that require authentication to access. For authentication, I have the users enter thier user/pass and click login, which is then sent...
3
by: Net Coder | last post by:
I'm trying to bind to DC by site. The environment is a AD 2K3 domain with multiple sites. For example, when my application is started, it checks for the site of the computer where the...
5
by: ABSMunkee | last post by:
I have a vb.net dll that has two functions: one allows a user to change their password in AD, the second allows the user to view their distinguishedname (based on their samaccountname). Both bind...
1
by: downlode | last post by:
Hi, I have a basic script for querying an ldap server. It works fine from my college's production server, but not from another server in the network, though I have been assured access should be...
1
by: Max-B | last post by:
Hi,I wrote a very simple script to perform ldap authentication. Here is a peace of code: if ($ldapconn) { // binding $ldapbind = ldap_bind($ldapconn, $ldaprdn, $ldappass); // verifica bind...
4
by: Sin Precedente | last post by:
I have a win2k server with multiple domains on it many of which have a generic contact us page with a form that when submitted calls an .asp page that utilizes CDONTS. These pages have worked...
3
by: aydeejay | last post by:
I'm trying to troubleshoot an issue where users are not able to bind with LDAP via "GetObject" through our ASP Classic Intranet if they stay logged in overnight (beyond their allowed login hours). ...
1
by: Markw | last post by:
Hi folks I think I've got a variable problem but not 100% sure. Background: I took the CMS example from chapter 6 in "Build your Own Database Driven Website Using PHP&MySQL" and have attempted to...
1
by: sowing | last post by:
I am trying to bind to a LDAP server, but failed. Code as follow: #!/usr/bin/perl use strict; use warnings; use Net::LDAP; use Data::Dumper; use Net::LDAP::Util qw(ldap_error_name ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.