ldap_get_option
(PHP 4 >= 4.0.4, PHP 5, PHP 7, PHP 8)
Get the current value for given option
Description
Sets value to the value of the specified option.
Parameters
ldapEither an
LDAP\Connectioninstance, returned byldap_connect(), to get the option for that connection, or null to get the global option.optionThe parameter
optioncan be one of:Option Type since LDAP_OPT_DEREFintLDAP_OPT_SIZELIMITintLDAP_OPT_TIMELIMITintLDAP_OPT_NETWORK_TIMEOUTintLDAP_OPT_PROTOCOL_VERSIONintLDAP_OPT_ERROR_NUMBERintLDAP_OPT_DIAGNOSTIC_MESSAGEstringLDAP_OPT_REFERRALSintLDAP_OPT_RESTARTintLDAP_OPT_HOST_NAMEstringLDAP_OPT_ERROR_STRINGstringLDAP_OPT_MATCHED_DNstringLDAP_OPT_SERVER_CONTROLSarrayLDAP_OPT_CLIENT_CONTROLSarrayLDAP_OPT_X_KEEPALIVE_IDLEint7.1 LDAP_OPT_X_KEEPALIVE_PROBESint7.1 LDAP_OPT_X_KEEPALIVE_INTERVALint7.1 LDAP_OPT_X_TLS_CACERTDIRstring7.1 LDAP_OPT_X_TLS_CACERTFILEstring7.1 LDAP_OPT_X_TLS_CERTFILEstring7.1 LDAP_OPT_X_TLS_CIPHER_SUITEstring7.1 LDAP_OPT_X_TLS_CRLCHECKint7.1 LDAP_OPT_X_TLS_CRL_NONEint7.1 LDAP_OPT_X_TLS_CRL_PEERint7.1 LDAP_OPT_X_TLS_CRL_ALLint7.1 LDAP_OPT_X_TLS_CRLFILEstring7.1 LDAP_OPT_X_TLS_DHFILEstring7.1 LDAP_OPT_X_TLS_KEYFILEstring7.1 LDAP_OPT_X_TLS_PACKAGEstring7.1 LDAP_OPT_X_TLS_PROTOCOL_MINint7.1 LDAP_OPT_X_TLS_PROTOCOL_MAXint8.4 LDAP_OPT_X_TLS_RANDOM_FILEstring7.1 LDAP_OPT_X_TLS_REQUIRE_CERTintvalueThis will be set to the option value.
Return Values
Success
Changelog
| Version | Description |
|---|---|
| 8.5.0 | ldap is now nullable. A ValueError is now thrown when passing an invalid option. |
Examples
Check protocol version
<?php
// $ds is a valid LDAP\Connection instance for a directory server
if (ldap_get_option($ds, LDAP_OPT_PROTOCOL_VERSION, $version)) {
echo "Using protocol version $version\n";
} else {
echo "Unable to determine protocol version\n";
}
?>Notes
This function is only available when using OpenLDAP 2.x.x OR Netscape Directory SDK x.x.