LDAP_OPT_SERVER_CONTROLS and
LDAP_OPT_CLIENT_CONTROLS require a list of
controls, this means that the value must be an array of controls. A
control consists of an oid identifying the control,
an optional value, and an optional flag for
criticality. In PHP a control is given by an
array containing an element with the key oid
and string value, and two optional elements. The optional
elements are key value with string value
and key iscritical with boolean value.
iscritical defaults to FALSE
if not supplied. See » draft-ietf-ldapext-ldap-c-api-xx.txt
for details. See also the second example below.

it seems that ldap_set_option returns 1 for bogus ldap_connect -ions also.ldap_connect always returns a resource (documented in thecomments of ldap_connect) so it is not possible to check if theldap server is there or alive or what. and because ldap_set_optionmust be between ldap_connect and ldap_bind, there seems tobe no sense in checking the return value.

it is a bit strange that ldap_bind is the first function which canreally check if a ldap resource is usable because it is the thirdfunction in line to use when working with openldap.