public function Connect() { Log::Debug('Trying to connect to LDAP'); $this->ldap = Net_LDAP2::connect($this->options->Ldap2Config()); if (PEAR::isError($this->ldap)) { $message = 'Could not connect to LDAP server. Check your settings in Ldap.config.php : ' . $this->ldap->getMessage(); Log::Error($message); throw new Exception($message); } $this->ldap->setOption(LDAP_OPT_REFERRALS, 0); $this->ldap->setOption(LDAP_OPT_PROTOCOL_VERSION, 3); return true; }