Forum und email


(PHP 3 >= 3.0.12, PHP 4, PHP 5)

ldap_errno -- Return the LDAP error number of the last LDAP command


int ldap_errno ( resource link_identifier )

Returns the standardized error number returned by the last LDAP command. This number can be converted into a textual error message using ldap_err2str().

Seznam parametrů


An LDAP link identifier, returned by ldap_connect().

Návratové hodnoty

Return the LDAP error number of the last LDAP command for this link.


Unless you lower your warning level in your php.ini sufficiently or prefix your LDAP commands with @ (at) characters to suppress warning output, the errors generated will also show up in your HTML output.

Příklad 1. Generating and catching an error

// This example contains an error, which we will catch.
$ld = ldap_connect("localhost");
$bind = ldap_bind($ld);
// syntax error in filter expression (errno 87),
// must be "objectclass=*" to work.
$res =  @ldap_search($ld, "o=Myorg, c=DE", "objectclass");
if (!
$res) {
"LDAP-Errno: " . ldap_errno($ld) . "<br />\n";
"LDAP-Error: " . ldap_error($ld) . "<br />\n";
"Argh!<br />\n");
$info = ldap_get_entries($ld, $res);
$info["count"] . " matching entries.<br />\n";