安装信息:
我有两台 Windows 服务器。其中一个(Windows Server 2008 R2)是具有 Active Directory (AD) 的域控制器 (DC)。它的名称是 s1.xyz.com。第二台(Windows Server 2003 R2)服务器正在运行 IIS,PHP.SSL 证书安装在第二台服务器上。
我已经在 DC 服务器上安装了 Active Directory 证书服务以充当证书颁发机构 (CA),并使用以下链接启用 LDAP over SSL(LDAPS):http:
//www.christowles.com/2010/11/enable-ldap- over-ssl-ldaps-on-windows.html
问题是什么:
实际上,我想为 AD 用户设置密码,所以我的要求是安全连接(LDAPS)。我可以在不安全的端口(389)上成功连接到 DC 并访问 AD 数据,但我无法使用 PHP ldap_bind() 函数在安全连接(端口 636)上绑定用户。当我运行脚本时,它给出“ldap_bind() [function.ldap-bind]:无法绑定到服务器:无法联系 LDAP 服务器”错误。
代码:
$ip="xxx.xxx.xxx.xx";
$ldaps_url="ldaps://s1.xyz.com:636/";
$ldap_url="s1.xyz.com";
$ldapUsername ="Administrator@xyz.com";
$ldapPassword="x1y1z1";
$ds=ldap_connect($ldaps_url);
//$ds=ldap_connect($ip,636);
ldap_set_option($ds, LDAP_OPT_PROTOCOL_VERSION,3);
ldap_set_option($ds, LDAP_OPT_REFERRALS,0);
$bth=ldap_bind($ds, $ldapUsername, $ldapPassword);
ldap_unbind($ds);
$ds="";