Jump to content

Archived

This topic is now archived and is closed to further replies.

uogiene

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!

Share this post


Link to post
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.

Share this post


Link to post
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... ???

Share this post


Link to post
Share on other sites
have you tried to actually connect and bind ldap to anything? without trying to [b]do[/b] something with it, it's going to be extremely difficult to know whether or not it's working.

Share this post


Link to post
Share on other sites

×

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.