This is my Action
public function loginAction()
{
$request= $this->getRequest();
if($request->isPost())
{
$username= $request->getPost('email');
$password= $request->getPost('password');
$auth = new AuthenticationService();
$adapter = new AuthAdapter(
array('server1'=>array(
'host' => '192.168.1.4',
'useStartTls' => false,
'useSsl' => false,
'accountDomainName' => 'coasting',
'accountDomainNameShort' => 'DOMAIN',
'accountCanonicalForm' => 3,
'accountFilterFormat' => '(&(objectClass=user)(sAMAccountName=%s))',
'baseDn' => 'CN=Users,DC=domain,DC=local',
'bindRequiresDn' => false,
'optReferrals' => false
)),
$username,
$password
);
$result = $auth->authenticate($adapter);
print_r($result);
}
}
Run Code Online (Sandbox Code Playgroud)
运行此操作后,以下错误将显示“0x7002:未加载 LDAP 扩展”,
/var/www/coasting/vendor/zendframework/zendframework/library/Zend/Authentication/Adapter/Ldap.php(140): Zend\Ldap\Ldap->__construct()
/var/www/coasting/vendor/zendframework/zendframework/library/Zend/Authentication/Adapter/Ldap.php(205): Zend\Authentication\Adapter\Ldap->getLdap()
/var/www/coasting/vendor/zendframework/zendframework/library/Zend/Authentication/AuthenticationService.php(110): Zend\Authentication\Adapter\Ldap->authenticate()
我该如何解决这个错误。如果还有其他设置?