Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/268.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php LDAP可以';t联系LDAP服务器:未知网络\u LDAP2错误(-1)_Php_Ldap_Openldap_Phpscheduleit - Fatal编程技术网

Php LDAP可以';t联系LDAP服务器:未知网络\u LDAP2错误(-1)

Php LDAP可以';t联系LDAP服务器:未知网络\u LDAP2错误(-1),php,ldap,openldap,phpscheduleit,Php,Ldap,Openldap,Phpscheduleit,我正在试图弄清客户端的LDAP问题,这个非描述性的Unknown错误给模拟留下了很多问题 让我先说我在一所大学工作,他们(IT)在很多事情上都使用LDAP。所以我知道他们的LDAP设置正确,工作正常。我们(我的部门)正在实施一种新的web软件,并希望将其用于身份验证。该软件称为PHPScheduleIT,它附带了LDAP插件。我已经确认,我们的服务器在ldap服务器的正确端口上确实有一个防火墙。话虽如此,以下是我从日志中得到的信息 我被告知将TLS设置设置为true,当我这样做时,我会在日志中看

我正在试图弄清客户端的LDAP问题,这个非描述性的
Unknown
错误给模拟留下了很多问题

让我先说我在一所大学工作,他们(IT)在很多事情上都使用LDAP。所以我知道他们的LDAP设置正确,工作正常。我们(我的部门)正在实施一种新的web软件,并希望将其用于身份验证。该软件称为PHPScheduleIT,它附带了LDAP插件。我已经确认,我们的服务器在ldap服务器的正确端口上确实有一个防火墙。话虽如此,以下是我从日志中得到的信息

我被告知将TLS设置设置为true,当我这样做时,我会在日志中看到:

01/22/14 16:47:30,243 [68660] DEBUG default - Loading plugin. Type=Authentication, Plugin=Ldap
01/22/14 16:47:30,267 [68660] DEBUG default - Trying to connect to LDAP
01/22/14 16:47:30,271 [68660] ERROR default - Could not connect to LDAP server. Check your  settings in Ldap.config.php : TLS could not be started: Can't contact LDAP server: Unknown Net_LDAP2 Error (-1)
01/22/14 16:47:30,272 [68660] ERROR default - Uncaught exception: exception 'Exception' with message 'Could not connect to LDAP server. Check your settings in Ldap.config.php : TLS could not be started: Can't contact LDAP server: Unknown Net_LDAP2 Error (-1)' in D:\devC\phpScheduleIt\plugins\Authentication\Ldap\Ldap2Wrapper.php:58
Stack trace:
#0 D:\devC\phpScheduleIt\plugins\Authentication\Ldap\Ldap.php(128): Ldap2Wrapper->Connect()
#1 D:\devC\phpScheduleIt\lib\Application\Authentication\WebAuthentication.php(93): Ldap->Validate('[REMOVED]', '[REMOVED]')
#2 D:\devC\phpScheduleIt\Presenters\LoginPresenter.php(99): WebAuthentication->Validate('[REMOVED]', '[REMOVED]')
#3 D:\devC\phpScheduleIt\Pages\LoginPage.php(198): LoginPresenter->Login()
#4 D:\devC\phpScheduleIt\Web\index.php(35): LoginPage->Login()
#5 {main}
关闭TLS时,日志相同,但错误如下:

01/22/14 16:47:50,527 [68660] ERROR default - Could not connect to LDAP server. Check your settings in Ldap.config.php : Bind failed: Can't contact LDAP server: Unknown Net_LDAP2 Error (-1)
在LDAP配置文件中,我不确定其中有多少是私有的,因此我删除了一些域和pw信息。然而,所有这些都是直接从它那里给我的

$conf['settings']['host'] = 'ldap.[domain.com]'; // comma separated list of ldap servers such as mydomain1,localhost
$conf['settings']['port'] = '636';      // default ldap port 389 or 636 for ssl.
$conf['settings']['version'] = '3';     // LDAP protocol version
$conf['settings']['starttls'] = 'true'; // TLS is started after connecting
$conf['settings']['binddn'] = '[user]@[domain.com]';    // The distinguished name to bind as (username). If you don't supply this, an anonymous bind will be established.
$conf['settings']['bindpw'] = '[password]'; // Password for the binddn. If the credentials are wrong, the bind will fail server-side and an anonymous bind will be established instead. An empty bindpw string requests an unauthenticated bind.
$conf['settings']['basedn'] = 'ou=[removed],dc=[removed],dc=[removed],dc=[removed]';    // LDAP base name
$conf['settings']['filter'] = '';   // Default search filter
$conf['settings']['scope'] = '';    // TLS is started after connecting
$conf['settings']['database.auth.when.ldap.user.not.found'] = 'true';   // if ldap auth fails, authenticate against phpScheduleIt database
$conf['settings']['ldap.debug.enabled'] = 'false';  // if LDAP2 should use debug logging
$conf['settings']['attribute.mapping'] = 'sn=sn,givenname=givenname,mail=mail,telephonenumber=telephonenumber,physicaldeliveryofficename=physicaldeliveryofficename,title=title';   // mapping of required attributes to attribute names in your directory
$conf['settings']['user.id.attribute'] = 'cn';  // the attribute name for user identification
它给了我以下信息:
主机
端口
starttls
binddn
bindpw
basedn
。所以我相信他们知道自己在做什么,这些领域是正确的。我已经删除了安全性的值

这是我的php服务器在phpinfo中的输出:

LDAP Support    enabled
RCS Version $Id$
Total Links 0/unlimited
API Version 3001
Vendor Name OpenLDAP
Vendor Version  20319
SASL Support    Enabled

Directive   Local Value Master Value
ldap.max_links  Unlimited   Unlimited
问题

如何记录/输出更具描述性的失败错误

有人知道还有什么“可能”会失败吗

有没有一种方法可以在不发送身份验证请求的情况下测试php与ldap服务器的连接


我尝试将LDAP配置设置为打开调试,但从未在任何地方看到日志。有人知道它将日志保存在哪里吗?

是否尝试使用类似的方式连接到LDAP服务器?是否可以尝试以下操作:将
端口设置为
389
。如果没有帮助,请将端口留在
636
并将
starttls
设置为
false
。更改端口时,您必须验证是否可以从主机访问该端口。@Ralf我已使用LDAPSoft LDAP管理工具连接。我已尝试将ports和starttls设置为false和true。我还尝试过只做一个简单的
ldap\u connect()
,然后做一个“ldap\u绑定”。我在连接上获得了成功,所以我知道这部分工作正常,只是绑定。在进一步的研究中,我注意到当通过LDAP管理工具连接时,我收到了一个证书警告,我在PHP手册中读到了这可能会导致错误。我正在调查此事。但是,我认为证书对于389并不重要,除非我们的LDAP服务器拒绝389--感谢您的输入。刚刚通过LDAPSoft验证,我在389上连接失败,所以他们只能在636上接受。但在636上,无论是否检查了USE SSL/TLS,它都可以工作。如果证书无法验证/不受信任,那么这肯定是一个问题。你能
telnet
到389端口吗?连接在纯文本端口(389)上启动,然后提升到TLS。如果您在安全端口(636)上启动连接,则应禁用starttls,因为您需要从一开始就与LDAP通话。是否有其他配置选项允许您指定协议方案(ldap与ldaps)?