Jump to content


Photo

LDAP and php problem


  • Please log in to reply
4 replies to this topic

#1 uogiene

uogiene
  • New Members
  • Pip
  • Newbie
  • 3 posts

Posted 30 September 2006 - 04:58 PM

Hi,
I'm having a little problem using LDAP over php in any way...
Here's my current server setup:
phpinfo relevant output

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 

As required I've uncommented following in php.ini

extension=php_ldap.dll

I've also copied libeay32.dll and ssleay32.dll to my SYSTEM folder

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

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

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

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!

#2 obsidian

obsidian
  • Staff Alumni
  • Advanced Member
  • 3,202 posts
  • LocationSeattle, WA

Posted 30 September 2006 - 05:06 PM

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:
<?php
$ldaphost = "ldaps://10.176.40.10/";
$connection = ldap_connect($ldaphost);
if (!$connection) {
  echo "Not connected!";
} else {
  echo "Connection successful!";
}
?>

once you are connected, you'll have to use ldap_bind() and other functions to actually run your queries agains the ldap server.
You can't win, you can't lose, you can't break even... you can't even get out of the game.

<?php
while (count($life->getQuestions()) > 0)
{   $life->study(); } ?>
  LINKS: PHP: Manual MySQL: Manual PostgreSQL: Manual (X)HTML: Validate It! CSS: A List Apart | IE bug fixes | Zen Garden | Validate It! JavaScript: Reference Cards RegEx: Everything RegEx

#3 uogiene

uogiene
  • New Members
  • Pip
  • Newbie
  • 3 posts

Posted 30 September 2006 - 05:12 PM

Thanks a lot your suggestion outputted:

Connection successful!

;D

#4 uogiene

uogiene
  • New Members
  • Pip
  • Newbie
  • 3 posts

Posted 30 September 2006 - 05:19 PM

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

#5 obsidian

obsidian
  • Staff Alumni
  • Advanced Member
  • 3,202 posts
  • LocationSeattle, WA

Posted 30 September 2006 - 06:07 PM

have you tried to actually connect and bind ldap to anything? without trying to do something with it, it's going to be extremely difficult to know whether or not it's working.
You can't win, you can't lose, you can't break even... you can't even get out of the game.

<?php
while (count($life->getQuestions()) > 0)
{   $life->study(); } ?>
  LINKS: PHP: Manual MySQL: Manual PostgreSQL: Manual (X)HTML: Validate It! CSS: A List Apart | IE bug fixes | Zen Garden | Validate It! JavaScript: Reference Cards RegEx: Everything RegEx




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users