问题描述:

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);

}

}

after running this action following error will showing '0x7002: LDAP extension not loaded',

/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()

How can i solve this error. If any other settings?

网友答案:

Install the PHP LDAP extension.

It seems that your PHP installation is missing te LDAP extension. Have a look at your Phpinfo and you will notice that there is no "ldap" section available. Therefore the basic functions for LDAP connections are missing. Hence the error.

How to install the extension depends on the used system. It might be something like "brew php-ldap" on Mac or "apt-get install php5-ldap" on a debian or ubuntu linux. Have a look at your favourite search engine on the web to find more information on that.

相关阅读:
Top