JavaScript Editor Javascript validator     Web page editor 

Configuration and connecting

Configuration and connecting -- How to configure Net_LDAP and connect to an LDAP server

Connecting to an LDAP server

To connect to an LDAP server, you should use Net_LDAP's static connect() method. It takes one parameter, an array full of configuration options, and either returns a Net_LDAP object if connecting works, or a Net_LDAP_Error object in case of a failure.

The following table lists all configuration options. If the default value for an option fits your needs, you don't need add it to your configuration array.

Table 54-1. Possible configuration options

hostLDAP server name to connect to. You can provide several hosts in an array in which case the hosts are tried from left to right.localhost
portPort on the server389
versionLDAP version3
starttlsTLS is started after connectingfalse
binddnThe distinguished name to bind as (username)(none)
bindpwPassword for the binddn(none)
basednLDAP base name (root directory)(none)
optionsArray of additional ldap options as key-value pairsarray()
filter Default search filter (string or preferably Net_LDAP_Filter object). See LDAP filters (objectClass=*)
scopeDefault search scope, see Searchsub

JavaScript Editor Javascript validator     Web page editor