LDAP questions 
Author Message
 LDAP questions

To all,

I need to do LDAP authentication in my scripts. But I'm not sure if
I'll be able to. Our webserver is a redhat 7.3 box. We are running
Active Directory on a Win2K box. Both boxes are local to each other. I
read in the php manual that php must be compiled --with-ldap=[dir].
Now, since my ldap is on a Win box, can I still access it and leave
the [dir] blank?  Perhaps I need to use Samba, which i have installed
already on the RH box. I don't have scheduled maintence until the
weekend so I have a few days to think about this, but can experiement.

Does anyone out there have any experience with this? I really, really
don't want to be forced to put php/webserver on a MS box.

Thanks for the help.

regards,

~mog~



Mon, 30 May 2005 00:44:07 GMT  
 LDAP questions
Hi,



Quote:
> I need to do LDAP authentication in my scripts. But I'm not sure if
> I'll be able to. Our webserver is a redhat 7.3 box. We are running
> Active Directory on a Win2K box. Both boxes are local to each other. I
> read in the php manual that php must be compiled --with-ldap=[dir].
> Now, since my ldap is on a Win box, can I still access it and leave
> the [dir] blank?  Perhaps I need to use Samba, which i have installed
> already on the RH box.

The issue is, that PHP has to be linked against an LDAP library for the
ldap_* functions to work, so you have to install one on the Linux box. That
doesn't mean you actually have to run an LDAP server on the box, just have
the libraries installed.

Installing OpenLDAP and compiling PHP against it should do the trick. If you
have the libraries in your library path, you can omit the directory from
the --with-ldap configure option.

Best regards,
Martijn.



Mon, 30 May 2005 05:31:41 GMT  
 LDAP questions
Hi,

Quote:
> Now, since my ldap is on a Win box, can I still access it and leave
> the [dir] blank?

A follow up on my own post, to get something out of the way...

The configure option --with-ldap does not have anything to do with the LDAP
server you are going to connect to. When I re-read your post, I figured that
maybe that's what you thought.

It could be that your PHP is already linked against an LDAP library. The way
to figure that out, is to call phpinfo() from a script and see if there's an
'ldap' section somewhere in the output that says 'LDAP support - enabled'.
If there isn't, any call to a ldap_* function will result in an error "Call
to undefined function".

When your PHP is ready to go, you can connect to any LDAP server (including
your Win2k box) with ldap_connect($hostname). The function I use to
authenticate against our Active Directory:

define ("ADDDOMAIN","your.activedirectory.domain");
define ("LDAPSVR","your.ldap.server");

  function userok ($login, $passwd) {
    $login=addslashes($login);

    // connect to LDAP-server
    $ldaplink=ldap_connect(LDAPSVR);
    if ($ldaplink) {

      if ($bindres) return 1;
      else return 0;

      ldap_close($ldaplink);
    }
    else {
      return 0;
    }
  }

Best regards,
Martijn.



Mon, 30 May 2005 06:20:15 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. ldap-client-cgi.py 0.5.0: WWW gateway for accessing LDAP servers

2. ldap-client-cgi.py 0.4.4: WWW gateway for accessing LDAP servers

3. wrote a simple LDAP script to contact ldap.bigfoot.com

4. LDAP -- is python-ldap still "it"?

5. LDAP search on Netscape LDAP server

6. LDAP interface

7. LDAP client

8. LDAP library?

9. Help with LDAP design

10. LDAP - WriteStream doesn't understand #clientCount

11. Looking for Matt Rosen - ST LDAP author

12. Looking for ST/LDAP author, Matt Rosen (again)

 

 
Powered by phpBB® Forum Software