ldap_bind をテストしているときは、ldap サーバーと同じドメイン上にあるためテスト マシンで動作しましたが、コードを Web ホスティングに移動すると
Warning: ldap_bind() [function.ldap-bind]: Unable to bind to server: Can't contact LDAP server in /home
そして、私はldapサーバーと同じドメインのブラウザからアクセスしているので、ホスティングによってldapサーバーに到達する必要がありますか?
<?php
// using ldap bind
$ldaprdn = 'user'; // ldap rdn or dn
$ldappass = 'pass'; // associated password
// connect to ldap server
$ldapconn = ldap_connect("server.com") or die("Could not connect to LDAP server.");
if ($ldapconn) {
// binding to ldap server
$ldapbind = ldap_bind($ldapconn, $ldaprdn, $ldappass);
// verify binding
if ($ldapbind & strlen($ldappass)>0) {
echo "H LDAP bind successful...";
} else {
echo "LDAP bind failed...";
}
}
?>