主机环境配置说明:openldap-2.2.29 / db-4.3.29 / openssl-0.9.8a代码:<?php$ldap_host="ldap://10.14.2.59"; $ldap_port="389"; $ldap_dn="cn=admin,dc=miracle,dc=com"; $ldap_pwd="miracle"; $ldap_conn=ldap_connect($ldap_host,$ldap_port)or die("LDAP connection failed"); ldap_bind($ldap_conn,$ldap_dn,$ldap_pwd)or die("LDAP bind failed"); ldap_unbind($ldap_conn)or die("LDAP unbind failed");?>错误:Warning: ldap_bind() [function.ldap-bind]: Unable to bind to server: Protocol error in D:\AppServ\www\others\ldap\index.php on line 16 LDAP bind failed解决:在slapd.conf 最后加一句:allow bind_v2原因(据openldap官网):OpenLDAP Software does not support LDAPv2 (now historic). OpenLDAP 2.x's slapd(8) can be configured to accept a version 2 LDAP Bind request, but expects requesting version 2 to speak a restricted, non-standard variant for LDAPv3 (basically LDAPv3 syntaxes and semantics in LDAPv2 PDUs). To enable this, place the following in your slapd.conf(5) file.
extension=php_ldap.dll 后面分号去掉
http://bbs.chinaunix.net/thread-499482-2-1.html
解决了
dns配置错误
$ldap_port="389";
$ldap_dn="cn=admin,dc=miracle,dc=com";
$ldap_pwd="miracle";
$ldap_conn=ldap_connect($ldap_host,$ldap_port)or die("LDAP connection failed");
ldap_bind($ldap_conn,$ldap_dn,$ldap_pwd)or die("LDAP bind failed");
ldap_unbind($ldap_conn)or die("LDAP unbind failed");?>错误:Warning: ldap_bind() [function.ldap-bind]: Unable to bind to server: Protocol error in D:\AppServ\www\others\ldap\index.php on line 16
LDAP bind failed解决:在slapd.conf 最后加一句:allow bind_v2原因(据openldap官网):OpenLDAP Software does not support LDAPv2 (now historic). OpenLDAP 2.x's slapd(8) can be configured to accept a version 2 LDAP Bind request, but expects requesting version 2 to speak a restricted, non-standard variant for LDAPv3 (basically LDAPv3 syntaxes and semantics in LDAPv2 PDUs). To enable this, place the following in your slapd.conf(5) file.