2014-02-07 349 views
1

我試圖從LDAP獲得認證,我歌廳錯誤 「的ldap_bind():無法綁定到服務器:無效的憑證」 任何一個可以提供關於此的任何信息。的ldap_bind():無法綁定到服務器:無效的DN語法

下面的代碼我使用:

$ldaphost = "ldap.mydomain.com"; $ldapport = 389; 
$ds = ldap_connect($ldaphost, $ldapport) or die("Could not connect to $ldaphost"); 
if ($ds) { 
    $username = "myUser"; 
    $upasswd = "*****"; 
    $binddn = "uid=$username,ou=people,dc=yourdomain,dc=com"; $ldapbind = ldap_bind($ds, $binddn, $upasswd); 
if ($ldapbind) { echo "login" ; } else { echo " not login"; } 
} 
+0

能*你*提供有關這方面的消息? – ixe013

+0

是否嘗試連接到Microsoft域? –

回答

1
$ldaphost = "ldap.mydomain.com"; 
$ldapport = 389; 

$ds = ldap_connect($ldaphost, $ldapport) or die("Could not connect to $ldaphost"); 
if ($ds) { 
$username = "myUser"; 
$upasswd = "*****"; 
$binddn = "cn=admin,dc=yourdomain,dc=com"; //cn=admin or whatever you use to login by phpldapadmin 
$ldapbind = ldap_bind($ds,$binddn, $upasswd); 

//check if ldap was sucessfull 
if ($ldapbind) { 
    echo "LDAP bind successful..."; 
} else { 
    echo "LDAP bind failed..."; 
} 
} 
相關問題