php - 使用 PHP 连接活动目录或 LDAP
问题描述
我正在尝试将窗口的活动目录或 LDAP 与用PHP 制作的应用程序 ( GLPI ) 连接起来。
连接参数:
与服务器连接:
$ds = ldap_connect($host, $port) // return true
@ldap_set_option($ds, LDAP_OPT_PROTOCOL_VERSION, 3);
@ldap_set_option($ds, LDAP_OPT_REFERRALS, 0);
@ldap_set_option($ds, LDAP_OPT_DEREF, $deref_options);
将连接与服务器以及用户和密码相关联
ldap_bind ($ds, $ login, $ password)
返回我:
“无法联系 LDAP 服务器”
我想知道该错误消息会发生什么,因为在第一种方法中它向我返回 true,这意味着如果它连接到服务器。
RootDN
这很好,并且拥有我正在使用的用户的所有权限。
默认服务器很好,我做到了ping
,telnet
.
注意:我已经下载了 LDAPExplorer 并建立了连接没有问题。
解决方案
是否缺少 :$ds = ldap_connect ...
就像它在您的代码中一样?
它应该是这样的:
$ds = ldap_connect($host, $port);
@ldap_set_option($ds, LDAP_OPT_PROTOCOL_VERSION, 3);
@ldap_set_option($ds, LDAP_OPT_REFERRALS, 0);
@ldap_set_option($ds, LDAP_OPT_DEREF, $deref_options);
ldap_bind ($ds, $login, $password)
推荐阅读
- wcf - WCF发现如何在不同的子网中找到服务器端点
- php - Codeigniter 3.x / $config['time_reference'] = 'gmt' 无法按预期工作
- verilog - 是否可以创建包含 2 个枚举数据类型的枚举数据类型?
- pytorch - Pytorch:裁剪激活的可学习阈值
- java - 在 Java 中对自定义日期类进行排序
- haskell - 非穷举模式 n 元组函数
- google-tag-manager - 除非处于预览模式,否则 Google 跟踪代码管理器不会发布以收集 url
- java - 当我希望我的线程共享一个 ArrayList 时,我在哪里实例化 ArrayList,以及如何从 main 方法访问它?
- python - scipy.integrate.odeint 是否可以输出内部计算
- alloy - 网络配置,例如 vlan 配置