当使用 LDAP for PHP 完成连接时


When the connection is done with ldap for PHP?

我正在尝试了解PHP的ldap函数以调试应用程序。

身份验证流程如下所示:

ldap_connect($host, $port);
ldap_set_option($ds, $option);
ldap_bind($ds, $rdn, $pwd);
ldap_search($smth);
ldap_get_entries($smtgelse);
ldap_close($ds);

我得到的错误是:

The gateway did not receive a timely response from the upstream server or application.

我怀疑防火墙会阻止响应,但我放了一个记录器来查看哪个语句正在阻止,这是ldap_bind语句。

如果是网络问题,它应该在ldap_connect语句上阻止,不是吗?

来自 PHP 文档 - http://php.net/ldap_connect:

When OpenLDAP 2.x.x is used, ldap_connect() will always return a resource as
it does not actually connect but just initializes the connecting parameters.
The actual connect happens with the next calls to ldap_* funcs, usually with
ldap_bind().