Setting and getting session settings

The ldap_set_option() API sets options for the specified LDAP connection. The ldap_get_option() API queries settings that are associated with the specified LDAP connection.

The following session settings can be set and retrieved by using the ldap_set_option() and ldap_get_option() APIs:
LDAP_OPT_SIZELIMIT
Get or set maximum number of entries that can be returned on a search operation.
LDAP_OPT_TIMELIMIT
Get or set maximum number of seconds to wait for search results.
LDAP_OPT_REFHOPLIMIT
Get or set maximum number of referrals in a sequence that the client can follow.
LDAP_OPT_DEREF
Get or set rules for following aliases at the server.
LDAP_OPT_REFERRALS
Get or set whether referrals must be followed by the client.
LDAP_OPT_DEBUG
Get or set debug options.
LDAP_OPT_SSL_CIPHER
Get or set SSL ciphers to use.
LDAP_OPT_SSL_CIPHER_EX
Specifies a set of TLS 1.2 ciphers for the TLS 1.2 protocol.
LDAP_OPT_SSL_SECURITY_PROTOCOL
Specifies a set of one or more protocols to use for secure communication with an LDAP server.
LDAP_OPT_SSL_TIMEOUT
Get or set SSL timeout for refreshing session keys.
LDAP_OPT_REBIND_FN
Get or set address of the setrebindproc application procedure.
LDAP_OPT_PROTOCOL_VERSION
Get or set LDAP protocol version to use (V2 or V3).
LDAP_OPT_SERVER_CONTROLS
Get or set default server controls.
LDAP_OPT_CLIENT_CONTROLS
Get or set default client library controls.
LDAP_OPT_UTF8_IO
Get or set mode for converting string data between the local code page and UTF-8.
LDAP_OPT_HOST_NAME
Get current host name (cannot be set).
LDAP_OPT_ERROR_NUMBER
Get error number (cannot be set).
LDAP_OPT_ERROR_STRING
Get error string (cannot be set).
LDAP_OPT_API_INFO
Get API version information (cannot be set).
LDAP_OPT_EXT_ERROR
Get extended error code.
LDAP_OPT_CONNECT_TIMEOUT
Set connect timeout value for LDAP C clients.
See LDAP_SET_OPTION syntax for LDAP V2 applications for important information if your LDAP application is based on the LDAP V2 APIs and uses the ldap_set_option() or ldap_get_option() functions. That is, you are using ldap_open, or your application uses ldap_init() and ldap_set_option() to switch from the default of LDAP V3 to use the LDAP V2 protocol and then uses the ldap_set_option() or ldap_get_option() calls.

Additional details on specific options for ldap_set_option() and ldap_get_option() are provided in the following sections.