简体   繁体   English

PHP ldap_bind错误

[英]PHP ldap_bind error

I am using xampp on windows 7. I uncomment the ;extension=php_ldap.dll to extension=php_ldap.dll in php.ini. 我在Windows 7上使用xampp。在php.ini中取消将;extension=php_ldap.dll注释为extension=php_ldap.dll then i copy the libeay32.dll, libsasl.dll, ssleay32.dll from C:\\xampp\\php to C:\\Windows\\system. 然后我将libeay32.dll,libsasl.dll,ssleay32.dll从C:\\ xampp \\ php复制到C:\\ Windows \\ system。 and restart apache. 并重新启动apache。

I think all is done well, here is the result in phpInfo function 我认为一切都做得很好,这是phpInfo函数的结果

LDAP Support - enabled LDAP支持-已启用

RCS Version - $Id: 4db15e5bb92af06390fd31ab784837ab21a3d2ce $ RCS版本-$ Id:4db15e5bb92af06390fd31ab784837ab21a3d2ce $

Total Links - 0/unlimited 链接总数-0 /无限制

API Version - 3001 API版本-3001

Vendor Name - OpenLDAP 供应商名称-OpenLDAP

Vendor Version - 20433 供应商版本-20433

SASL Support - Enabled SASL支持-已启用

Here is my code 这是我的代码

<?php
//using ldap bind anonymously
//connect to ldap server
$ldapconn = ldap_connect("ldap.example.com")
    or die("Could not connect to LDAP server.");

if ($ldapconn) {
    // binding anonymously
    $ldapbind = ldap_bind($ldapconn);

    if ($ldapbind) {
        echo "LDAP bind anonymous successful...";
    } else {
        echo "LDAP bind anonymous failed...";
    }
}
?>

I took the code here php.net/manual And the error massage is 我在这里取了代码php.net/manual并且错误消息是

ldap_bind(): Unable to bind to server: Can't contact LDAP server in ldap_bind():无法绑定到服务器:无法与LDAP服务器联系

There seems to be an issue with connecting to your LDAP-Server from your webserver. 从Web服务器连接到LDAP服务器似乎存在问题。 Contrary to the naming ldap_connect does not connect to the server but verifies that the given server name looks OK (validates as FQDN without doing an actual lookup). 相反,命名ldap_connect 无法连接到服务器,但验证给定服务器名字看起来OK(确认出现FQDN没有做一个实际的查找)。 The connection is actually done on calling ldap_bind . 该连接实际上是在调用ldap_bind完成的。 Therefore the connection issue first surfaces on the ldap_bind. 因此,连接问题首先出现在ldap_bind上。

Try to bind to your LDAP-Server from the machine the webserver is running on with a different LDAP-Tool like fi. 尝试使用其他LDAP工具(例如fi)从运行网络服务器的计算机上绑定到LDAP服务器。 jXplorer. jXplorer。 If that doesn't work, there seems to be a network-issue hindering the LDAP-connection. 如果这不起作用,则似乎是网络问题阻碍了LDAP连接。

Just to verify: You do have an LDAP-Server running and are not actually trying to literally bind to ldap.example.com ? 只是为了验证一下:您确实正在运行LDAP服务器,并且实际上并没有尝试真正地绑定到ldap.example.com吗?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM