[Samba] php ldap unable bind to Samba4 AD after 4.4.2

Kelvin Yip kelvin at icshk.com
Mon Apr 18 06:59:39 UTC 2016

Hi all,


Before Samba 4.4.2, I use the following php code to connect to samba. Now, I
can only use "ldap server require strong auth = no" to connect to Samba

I tried ldap server require strong auth = allow_sasl_over_tls or Yes. and
switch to ldaps:// None of the combination works.

Does anyone figure out what should I do to connect samba ldap with "strong
auth" ??

Thanks a million.


        $ldapServer = "ldap://";


        $ds=ldap_connect($ldapServer) or die("Could not connect to LDAP
server.");  // must be a valid LDAP server!

        ldap_set_option($ds, LDAP_OPT_PROTOCOL_VERSION, 3);

        ldap_set_option($ds, LDAP_OPT_REFERRALS, 0);


        if ($ds) {

                        if ($_POST["UserName"]){

                                $ldaprdn = 'MYDOMAIN' . "\\" .

                        } else if ($_POST["UserName"]){

                                $ldaprdn = 'MYDOMAIN' . "\\" .


                       $ldapbind = @ldap_bind($ds, $ldaprdn,


More information about the samba mailing list