I'm trying to connect, then to log on an LDAP server with the following script:
<?php
echo "Trying to connect<BR>";
$ds=ldap_connect("localhost");
if ($ds)
{
echo "Connected<BR>";
echo "Trying to log on<BR>";
$rep = ldap_bind($ds, "cn=Admin,o=MyOrg", "MyPasswd");
echo "Answer : $rep<BR>";
echo "Closing<BR>";
ldap_close($ds);
}
else echo "Unable to connect";
?>
Then I can see this on my browser screen
Trying to connect
Connected
Trying to log on
Warning: LDAP: Unable to bind to server: Unknown error in /home/httpd/ldap.php3 on line 9
Answer :
Closing
But, with an anonymous connection, everything seems to work:
<?php
echo "Trying to connect<BR>";
$ds=ldap_connect("localhost");
if ($ds)
{
echo "Connected<BR>";
echo "Trying to log on<BR>";
$rep = ldap_bind($ds);
echo "Answer : $rep<BR>";
echo "Closing<BR>";
ldap_close($ds);
}
else echo "Unable to connect";
?>
2nd screen :
Trying to connect
Connected
Trying to log on
Answer :1
Closing
Can somebody help me ?
(I'm using Apache 1.3.12 and PHP 3.0.15)