我有以下代碼 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); } }問題從今天早上開始,我遇到了這個(gè)錯(cuò)誤,讓我很頭疼:Warning: ldap_bind(): Unable to bind to server: Can't contact LDAP server [...]在 Windows 上一切正常,當(dāng)我在 CentOS 生產(chǎn)服務(wù)器上執(zhí)行代碼時(shí),它停止工作。我已經(jīng)檢查過的OpenLDAP 已安裝并啟用LDAP 服務(wù)器可從 CentOS 服務(wù)器訪問(Kerberos 在同一臺(tái)機(jī)器上沒有遇到任何問題)我已經(jīng)嘗試過的重新安裝了php-ldap擴(kuò)展檢查憑據(jù)和地址一百萬次附加信息ConfigH::getConfig()->ldap->host 返回類似“adserver.ourcompany.com”的內(nèi)容,這是我們的 LDAP 服務(wù)器的地址ConfigH::getConfig()->ldap->serviceAccount->bindDN 返回一個(gè)有效的綁定 DNConfigH::getConfig()->ldap->serviceAccount->password 返回服務(wù)賬號(hào)的密碼
CentOS 7 上的 PHP:LDAP 無法綁定到服務(wù)器
慕尼黑8549860
2022-10-09 20:09:36