donglinxia1541 2010-03-23 15:12 采纳率: 0%
浏览 142
已采纳

php / ldap - 绑定失败,但errorno不执行

I am trying to connect to ldap with a php web application. If the username/password is correct everything works fine however if the username/password is incorrect I get the following error:

PHP Warning: ldap_bind() [function.ldap-bind]: Unable to bind to server: Invalid credentials

for some reason I am not able to look at the errorno or the state of the bind variable afterwards to print the appopriate user friendly error message.

any ideas?

  • 写回答

2条回答 默认 最新

  • dprlv04662 2010-03-23 15:22
    关注

    The problem is most likely that ldap_errno takes the ldap connection resource, and as ldap_bind failed you can't use it's result to retrieve the errno.

    Also: have you tried suppressing the error via the @ sign?

    e.g.:

    $ldapconn = ldap_connect("localhost");
    @$ldapbind = ldap_bind($ldapconn, $ldaprdn, $ldappass);
    
    if( $ldapbind )
    {
      // Everything went fine
    } else {
      // Use the connection resource for ldap_errno
      $errno = ldap_errno( $ldapconn );
    
      // Check the error number, print an error message (...)
    }
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥30 线性代数的问题,我真的忘了线代的知识了
  • ¥15 有谁能够把华为matebook e 高通骁龙850刷成安卓系统,或者安装安卓系统
  • ¥188 需要修改一个工具,懂得汇编的人来。
  • ¥15 livecharts wpf piechart 属性
  • ¥20 数学建模,尽量用matlab回答,论文格式
  • ¥15 昨天挂载了一下u盘,然后拔了
  • ¥30 win from 窗口最大最小化,控件放大缩小,闪烁问题
  • ¥20 易康econgnition精度验证
  • ¥15 msix packaging tool打包问题
  • ¥28 微信小程序开发页面布局没问题,真机调试的时候页面布局就乱了