duanlidi1051 2010-10-14 10:56
浏览 38

在Windows 2008上使用PHP和LDAP搜索问题

I am trying to search through LDAP user entries on a Windows 2008 Server using PHP - PEAR's Net_LDAP2 package to be specific. I have successfully connected to the server as well as bind a user; however, searching for a user results in LDAP_OPERATIONS_ERROR. The most I can find as a solution on this is that it's hard to nail down a solution.

Is anyone familiar with connecting to LDAP via PHP on a Windows 2008 and would know the tweak that's need to access to the directory?

// LDAP Abstraction Layer with static instance of NET_LDAP2.
$LDAPConnection = new LDAPAbstractionLayer('username', 'password');
// Simple filter
$filter = Net_LDAP2_Filter::create('sn', 'begins',  'S');
$searchbase = 'DC=example,DC=domain';
$options = array('scope' => 'sub', 'attributes' => array('sn'));
$search = $LDAPConnection->connection->search($searchbase, $filter, $options);

Thanks for your help.

  • 写回答

1条回答 默认 最新

  • dongwen2794 2011-01-20 13:21
    关注

    Are you successfully bound to the LDAP server? I don't know much about Active Directory, but in OpenLDAP you can anonymously bind to an LDAP server, and if configured so, you can make searches but you'll require stronger authentication to have write access.

    So the bottomline is: If you're anonymously bound to the server (because authentication with user/password failed), can you do anonymous searches?

    评论

报告相同问题?

悬赏问题

  • ¥15 想问一下树莓派接上显示屏后出现如图所示画面,是什么问题导致的
  • ¥100 嵌入式系统基于PIC16F882和热敏电阻的数字温度计
  • ¥15 cmd cl 0x000007b
  • ¥20 BAPI_PR_CHANGE how to add account assignment information for service line
  • ¥500 火焰左右视图、视差(基于双目相机)
  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号