Clicky

Hello all,

Notice: I am pretty new to LDAP.

I currently have a Xampp package installed. With it I create php pages and I would like to be able to communicate to a LDAP database. I have been provided the connection parameters from my administrators. Here is my code in PHP where I try to connect to the LDAP server:

 $ldapserver = "ldap://dev-signature.ls.serverdb:363"; $ldaprdn  = "uid=_username, ou=ServiceAccounts, dc=ls,dc=serverdb"; $ldappass = "superpassword";  $handle = ldap_connect($ldapserver); $bind = ldap_bind($handle, $ldaprdn, $ldappass);                             
1: 2: 3: 4: 5: 6: 

Select allOpen in new window



This code gives me the following error: Warning: ldap_bind() [function.ldap-bind]: Unable to bind to server: Local error

This mean the connection to LDAP was fine, but the bind is not working properly.

What I have discovered recently is that I need to connect in SSL, which mean I will need to connect to a ldaps:// instead of ldap://. To do this, I found the following information on a PHP documentation page:

To use LDAP with SSL, compile OpenLDAP 2.x.x with SSL support, configure PHP with SSL, and set this parameter as ldaps://hostname/.


Now I know PHP is configured with SSL. But I have absolutly no idea how to compile OpenLDAP with SSL support.

Any help is appreciated.

asked 08/30/2011 11:00

Etdashou's gravatar image

Etdashou ♦♦


9 Answers:
If your installed package of OpenLDAP provides SSL support, there is no need to recompile it.

Compiling is the process of translating source code (programming language) into object code and executable files (code processable by a computer's CPU). You only need to do that if you have the source code and want to create the executable files and libraries.

Since you have an SSL-enabled package, you can just skip the compiling step entirely.
link

answered

svgmuc's gravatar image

svgmuc

Hi svgmuc,

I have verified the openLdap webpage (http://www.openldap.org/) but I don't understand what need to be installed exactly so it would work with PHP.

If anyone can help me with the installation process I would greatly appreciate.
link

answered 2011-08-31 at 08:27:39

Etdashou's gravatar image

Etdashou

You need OpenLDAP and the apache module ldap_mod. The OpenLDAP version must have SSL support, if you have that requirement for your PHP code.

You don't need anything else.
link

answered 2011-08-31 at 09:36:46

svgmuc's gravatar image

svgmuc

Ok, in my apache httpd.conf file I have "LoadModule ldap_module modules/mod_ldap.so" enabled OK.

The "The OpenLDAP version must have SSL support, if you have that requirement for your PHP code." part now.

I have Apache on Windows server. So I have found this website: http://www.userbooster.de/en/download/openldap-for-windows.aspx

When I install the package, I don't understand what exactly I need to install. Could you help me with this?
link

answered 2011-08-31 at 09:50:10

Etdashou's gravatar image

Etdashou

The provided package supports SSL. You don't need to change anything. Just follow the installation instructions and use the BDB backend.

It will just need configuration after you're done installing. If you are not proficient with LDAP, I recommend phpLDAPadmin to fill the database. The initial login credentials are mentioned at the bottom of the installation instruction page.
link

answered 2011-08-31 at 12:43:43

svgmuc's gravatar image

svgmuc

Hmmm,

Perhaps I have not explained myself correctly and I am sorry about that.

But if I understand correctly what you are saying, I will install a LDAP database with that. However I already have a LDAP database somewhere in my network. All I want to do is to connect to it with php in SSL.

I have tried the package and their is a client, a server and more.

I hope I explained myself correctly.
link

answered 2011-08-31 at 13:31:35

Etdashou's gravatar image

Etdashou

You don't need an OpenLDAP server on your system. But you need the OpenLDAP client libraries which are in the same package and most likely not available separately.

Make sure the php ldap extension is enabled.
According to http://www.php.net/manual/en/ldap.installation.php, make sure that libeay32.dll and ssleay32.dll are located in the search path (%PATH%).

After that, you should be able to connect to your LDAP server without a problem.
link

answered 2011-09-01 at 07:13:40

svgmuc's gravatar image

svgmuc

Ok, this been a long time.

I have been able to solve my problem. Follow these steps: http://greg.cathell.net/php_ldap_ssl.html

And it works very well.

I will also assign points to svgmuc for his time, you did help me.
link

answered 2011-09-01 at 07:25:21

Etdashou's gravatar image

Etdashou

link

answered 2011-11-10 at 07:43:43

Etdashou's gravatar image

Etdashou

Your answer
[hide preview]

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Tags:

×37
×13
×191

Asked: 08/30/2011 11:00

Seen: 282 times

Last updated: 11/14/2011 05:16