473,799 Members | 3,158 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

2 New Member
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.ph p on line 26

I can access ldap.berkeley.e du 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 18724
pbmods
5,821 Recognized Expert Expert
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
eleland
2 New Member
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 Recognized Expert Expert
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
1095
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 to an LDAP Server (NOVELL) - if binding is successful, I use the login object to retrieve various fields/attributes of the LDAP directory for that user. This works just fine, but what I want to do is transparently log the user in - so they do...
3
1835
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 application is running. Then, it looks for a DC in the site and then all DirectorySearcher and DIrectoryEntry operations will use a binding string aimed at that DC on the site. If the DC is not available, then a default server, the PDC emulator is used.
5
5020
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 via an SSL connection and appear to work well. I am implementing the dll through an asp interface on the DC that holds the fsmo role of PDC in a domain with several DCs with a replication delay of up to an hour between the DCs. The issue I...
1
2110
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 allowed from there. It fails at the ldap_bind() function. This function only returns a boolean value. How might I retrieve a meaninful error message? Any ideas where the problem is likely to lie, with this basic info?
1
10223
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 if ($ldapbind) {
4
5699
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 extremely well in the past until a couple days ago when all of a sudden every time that page is called i'm getting event 4000 in source smtpsvc Message delivery to the remote domain 'mydomain.com' failed for the following reason: Unable to bind to...
3
5864
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). The problem does not occur when performing the same bindings using a logon script. So, the user logs in, is able to perform queries all day, and then fails to log out at the end of the day. We'd prefer that they did log out nightly, but it...
1
2413
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 modify it for use in my own database. It almost works for me LOL. contact.php returns my dive buddies first and last name and gives me the option to either Edit or Delete them. Currently the delete option is not active. When I choose to edit...
1
8357
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 ldap_error_text);
0
9685
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10470
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10247
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10214
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10023
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9067
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7561
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5459
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4135
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.