您好,
我尝试使用php代码连接ldap服务器。
ERROR:
但它会抛出错误,因为致命错误ldap_connect未定义?
以下是代码:
<?php
// using ldap bind
$ldaprdn = $_SERVER['PHP_AUTH_USER']; // ldap rdn or dn
echo $ldaprdn;
$ldappass = $_SERVER['PHP_AUTH_PW']; // associated password
// connect to ldap server
$ldapconn = ldap_connect("www.analog.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)
{
echo "LDAP bind successful...";
} else {
echo "LDAP bind failed...";
}
}
?>
在(php.ini)文件中进行了尝试: