我似乎无法使用PHP安全地绑定到Active Directory.未加密的连接工作正常.使用其他客户端可以安全绑定,例如通过SSL使用LDAPAdmin进行连接.这里有什么问题?是否有一些我缺少的LDAP SSL模块?如何使用PHP安全绑定到服务器?
我注意到phpinfo()cURL支持ldap/ldaps - 利用它在php中执行安全绑定有什么好的例子?这是一个可行的解决方法吗?
的phpinfo();
ldap
LDAP Support enabled
RCS Version $Id: ldap.c 293036 2010-01-03 09:23:27Z sebastian $
Total Links 0/unlimited
API Version 3001
Vendor Name OpenLDAP
Vendor Version 20421
SASL Support Enabled
Run Code Online (Sandbox Code Playgroud)
尝试使用Ubuntu 10.04 repo中的PHP版本5.3.2-1ubuntu4.7绑定到Active Directory服务器
$username = 'user';
$password = 'passwd';
$account_suffix = '@example.com';
$hostnameSSL = 'ldaps://ldap.example.com:636';
$hostnameTLS = 'ldap.example.com';
$portTLS = 389;
ldap_set_option(NULL, LDAP_OPT_DEBUG_LEVEL, 7);
// Attempting fix from http://www.php.net/manual/en/ref.ldap.php#77553
putenv('LDAPTLS_REQCERT=never');
####################
# SSL bind attempt #
####################
// Attempting syntax from http://www.php.net/manual/en/function.ldap-bind.php#101445 …Run Code Online (Sandbox Code Playgroud)