安装ldap
下载openldap-for-windows.msi,并一路next下去。
全部默认,在设置最近一个管理员密码时(第二个secret)时,把它改了.
再修改安装目录\slapd.conf里的这两行为,因为我不喜欢它显示maxcrccom,再在服务器重启openldap服务,或者重启电脑也可以.
suffix "dc=pk17s,dc=cn"
rootdn "cn=Manager,dc=pk17s,dc=cn"
然后用php测试,测试代码是:
<?php
$ldap_host = "ldap://localhost";
$ldap_port = 389;
$ldap_conn = ldap_connect($ldap_host, $ldap_port) or die("Can not connect LDAP server.");
$rootdn = 'cn=Manager,dc=pk17s,dc=cn';
$rootpw = 'secret';
ldap_bind($ldap_conn, $rootdn, $rootpw) ;//or die("Can not binding to LDAP server.");
var_dump($ldap_conn);
?>
下载安装phpldapadmin
输入安装目录/ 输出用户名: Manager,dc=pk17s,dc=cn 密码:你改才修改的密码,它是第二个secret时修改的.
问题:Could not determine the root of your LDAP tree.
It appears that the LDAP server has been configured to not reveal its root.
Please specify it in config.php
回答:
check this value:
$ldapservers->SetValue($i,'server','base',array(''));
change it to for "example.com"
$ldapservers->SetValue($i,'server','base',array('dc=example,dc=com'));
check this value:
$ldapservers->SetValue($i,'login','dn',' ');
chang it to
$ldapservers->SetValue($i,'login','dn','cn=Manager,dc=example,dc=com');
问题:This base cannot be created with PLA.
回答:创建pk17s.ldif
dn: dc=pk17s,dc=cn
objectClass: domain
objectClass: top
dc: pk17s
dn: ou=People,dc=pk17s,dc=cn
objectclass: top
objectclass: organizationalUnit
ou: People
description: Container for user entries
再输入: slapadd -f slapd.conf -l pk17s.ldif
问题:ldif_read_file: Permission denied for
回答:给data/和slapd.d/目录增加evenyone所有权限.
No comments:
Post a Comment