Problem with LDAP via SSL

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
AlexCh
Forum Newbie
Posts: 3
Joined: Thu May 07, 2009 6:33 pm

Problem with LDAP via SSL

Post by AlexCh »

I have a problem with LDAP over SSL.
I install Active Directory (ADAM) on Win XP and tuned up all necessary certificates for ADAM. So I can connect from ldp.exe to ADAM with SSL on port 636.
But I can't make it from PHP.

Code: Select all

if ($this->_use_ssl){
            $this->_conn = ldap_connect("ldaps://".$dc, 636);
        } else {
            $this->_conn = ldap_connect($dc, 389);
        }
        //set some ldap options for talking to AD
        ldap_set_option($this->_conn, LDAP_OPT_PROTOCOL_VERSION, 3);
        ldap_set_option($this->_conn, LDAP_OPT_REFERRALS, 0);
        $this->_bind = ldap_bind($this->_conn,$this->_ad_username.$this->_account_suffix,$this->_ad_password);
If I try without SSL it works perfect. But with ssl it always give me a ERROR
FATAL: AD bind failed. Either the LDAPS connection failed or the login credentials are incorrect.PHP Warning: ldap_bind() [function.ldap-bind]: Unable to bind to server: Can't contact LDAP server in C:\Inetpub\wwwroot\sugarcrm\include\ldap\adLDAP.php on line 118


Somebody can help me?
Last edited by AlexCh on Mon May 11, 2009 6:03 pm, edited 2 times in total.
AlexCh
Forum Newbie
Posts: 3
Joined: Thu May 07, 2009 6:33 pm

Re: Help!!! with LDAP SSL

Post by AlexCh »

Please. Any ideas.
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: Help!!! with LDAP SSL

Post by Christopher »

1) Don't use "Help!!!" in your title or posts.

2) Does the server you are connecting to support SSL?

3) Have you tried it without the 636? (see note in documentation for port parameter: http://us.php.net/ldap-connect)
(#10850)
AlexCh
Forum Newbie
Posts: 3
Joined: Thu May 07, 2009 6:33 pm

Re: Help!!! with LDAP SSL

Post by AlexCh »

arborint wrote:1) Don't use "Help!!!" in your title or posts.

2) Does the server you are connecting to support SSL?
Yes server support SSL and I can connect and make bind from ldp.exe(simple tools for Active Directory)
I use Microsoft Active Directory for application(ADAM) as a LDAP server.
arborint wrote:
3) Have you tried it without the 636? (see note in documentation for port parameter: http://us.php.net/ldap-connect)
It is working perfect without SSL. But does not work with SSL.
I configured php, openssl and ldap.conf as described in http://greg.cathell.net/php_ldap_ssl.html

But it is not working still
Post Reply