What are the best practices for setting a higher page size for LDAP queries in PHP when dealing with MS Active Directory servers?

When dealing with MS Active Directory servers in PHP, it is recommended to set a higher page size for LDAP queries to improve performance and avoid potential issues with large result sets. This can be achieved by adjusting the `ldap_set_option()` function to set the LDAP_OPT_SIZELIMIT option to a higher value.

// Connect to the LDAP server
$ldapconn = ldap_connect('ldap://yourdomain.com');

// Set the page size for LDAP queries
ldap_set_option($ldapconn, LDAP_OPT_SIZELIMIT, 1000);

// Bind to the LDAP server
ldap_bind($ldapconn, 'username', 'password');

// Perform LDAP query
$result = ldap_search($ldapconn, 'ou=users,dc=yourdomain,dc=com', '(&(objectClass=user)(sAMAccountName=*))');

// Get the LDAP search results
$entries = ldap_get_entries($ldapconn, $result);

// Close the LDAP connection
ldap_close($ldapconn);