私はこの機能を持っています:
<?php
private function spawnAdapter($credentials) {
//$ldapConfig = array("server1" => array(
// "host" => "172.16.100.32",
// "useStartTls" => 1,
// "accountDomainName" => "schoolxp",
// "accountDomainNameShort" => "schoolxp",
// "accountCanonicalForm" => 3,
// "baseDn" => "DC=schoolxp",
//));
// We must retrieve the LDAP servers from the conf
$ldapConfig = $this->_config->ldap->toArray();
// Remove the log path, otherwise the adapter will think this is
// one of our servers and fail.
unset($ldapConfig['log']);
$adapter = new Zend_Auth_Adapter_Ldap(
$ldapConfig,
$credentials['username'],
$credentials['password']
);
return $adapter;
}
?>
また、次のような ini 構成ファイル:
[production]
ldap.log.enabled = 1
ldap.log.path = "../logs/ldap.log"
; Place your Active Directory Server Settings Here.
ldap.server1.host = "172.16.100.32"
ldap.server1.useStartTls = 1
ldap.server1.accountDomainName = "schoolxp"
ldap.server1.accountDomainNameShort = "schoolxp"
ldap.server1.accountCanonicalForm = 3
ldap.server1.baseDn = "DC=schoolxp"
PHP 配列が Auth_Adapter に使用されている場合、コードは正常に動作しますが、INI 構成を使用するように切り替えると、不明なエラーで失敗します。
INI ファイル配列と PHP 配列の両方で print_f を実行しましたが、それらは同じですが、LDAP アダプターはログ ファイルで例外をスローします。
興味深いことに、ログの接続文字列は、INI ファイルとアレイの両方で同一です。興味のある方は、ログ ファイルをご覧ください: http://pastebin.com/V5Nyz9FK
状況に光を当てていただければ幸いです