PHP を使用して LDAP 認証を使用しようとしています。
以下は私のコードです:
<?php
$ldaphost = 'ldap://ldapServer';
$ldapport = 389;
$ds = ldap_connect($ldaphost, $ldapport)
or die("Could not connect to $ldaphost");
ldap_set_option($ldapconn, LDAP_OPT_PROTOCOL_VERSION, 3);
ldap_set_option($ldapconn, LDAP_OPT_REFERRALS, 0);
//ldap_set_option($ds, LDAP_OPT_DEBUG_LEVEL, 7);
if ($ds)
{
$username = "testuser@domain.com";
$upasswd = "testpass";
$ldapbind = ldap_bind($ds, $username, $upasswd);
if ($ldapbind)
{print "Congratulations! $username is authenticated.";}
else
{print "Access Denied!";}
}
?>
しかし、それは以下のエラーを発生させます:
PHP 警告::
ldap_bind()
サーバーにバインドできません: LDAP サーバーに接続できません
どうすれば解決できますか?
注:ldap.config
フォーラムでこの用語に出くわしたので、どこかにファイルが必要ですか? 私のマシンにはそのようなファイルはありません。私はphp_ldap.dll
extフォルダーにあり、使用していWindows
ます。