Jump to content

LDAP and php problem


Recommended Posts

Hi,
I'm having a little problem using LDAP over php in any way...
Here's my current server setup:
phpinfo relevant output
[quote]
Apache/1.3.33 (Win32) PHP/4.4.0

ldap
LDAP Support  enabled 
RCS Version  $Id: ldap.c,v 1.130.2.13 2005/05/08 16:06:24 sniper Exp $ 
Total Links  0/unlimited 
API Version  2004 
Vendor Name  OpenLDAP 
Vendor Version  0  [/quote]As required I've uncommented following in php.ini[quote]
extension=php_ldap.dll
[/quote]
I've also copied libeay32.dll and ssleay32.dll to my SYSTEM folder

I'm using following code to query LDAP
[code]
<?php

$ldaphost = "ldaps://10.176.40.10/";

// Connecting to LDAP
$ldapconn = ldap_connect($ldaphost)
        or die("Could not connect to {$ldaphost}");
?>
[/code]

I just get a blank page...
If I do some echo'ing in that code I get the echo output...
Any ideas what could be wrong?
It looks as if the LDAP is not enabled properly

Thanks for your help!
Link to comment
Share on other sites

if you're not getting anything, you're probably connected just fine. ldap_connect() doesn't actually query anything at all, it simply attempts to make a connection to the server. you'll have to define your error checking a little more clearly to see if you're having any issues:
[code]
<?php
$ldaphost = "ldaps://10.176.40.10/";
$connection = ldap_connect($ldaphost);
if (!$connection) {
  echo "Not connected!";
} else {
  echo "Connection successful!";
}
?>
[/code]

once you are connected, you'll have to use ldap_bind() and other functions to actually run your queries agains the ldap server.
Link to comment
Share on other sites

on the other hand
[code]<?php
$ldaphost = "ldaps://10.176.45.1/";
$connection = ldap_connect($ldaphost);
if (!$connection) {
  echo "Not connected!";
} else {
  echo "Connection successful!";
}
?>[/code]
gave same output...
10.176.45.1 being ip that does not exsists...
something is not right... ???
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.