我有以下代碼 public function openConnection() { $this->ldapServerHandle = ldap_connect(ConfigH::getConfig()->ldap->host); $bindDN = ConfigH::getConfig()->ldap->serviceAccount->bindDN; if ($this->ldapServerHandle) { $this->ldapBindHandle = ldap_bind( $this->ldapServerHandle, $bindDN, ConfigH::getConfig()->ldap->serviceAccount->password ); if (!$this->ldapBindHandle) { $errorMsg = "LDAP::__construct(): Could not bind the service account ".$bindDN; LoggerH::emergency($errorMsg); throw new LDAPException($errorMsg); } } else { $errorMsg = "LDAP::__construct(): Could not connect to the LDAP server ".ConfigH::getConfig()->ldap->host; LoggerH::emergency($errorMsg); throw new LDAPException($errorMsg); } }問題從今天早上開始,我遇到了這個錯誤,讓我很頭疼:Warning: ldap_bind(): Unable to bind to server: Can't contact LDAP server [...]在 Windows 上一切正常,當我在 CentOS 生產服務器上執行代碼時,它停止工作。我已經檢查過的OpenLDAP 已安裝并啟用LDAP 服務器可從 CentOS 服務器訪問(Kerberos 在同一臺機器上沒有遇到任何問題)我已經嘗試過的重新安裝了php-ldap擴展檢查憑據和地址一百萬次附加信息ConfigH::getConfig()->ldap->host 返回類似“adserver.ourcompany.com”的內容,這是我們的 LDAP 服務器的地址ConfigH::getConfig()->ldap->serviceAccount->bindDN 返回一個有效的綁定 DNConfigH::getConfig()->ldap->serviceAccount->password 返回服務賬號的密碼
CentOS 7 上的 PHP:LDAP 無法綁定到服務器
慕尼黑8549860
2022-10-09 20:09:36