<?php
// A NULL connection sets the option for the whole process (OpenLDAP only).
// Set before ldap_connect(), it also traces the initialization; set later,
// only the operations that follow are traced.
// 7 combines the OpenLDAP levels 1 (trace), 2 (packets) and 4 (arguments).
// The traces are written to stderr, not to the output of the script.
ldap_set_option(null, LDAP_OPT_DEBUG_LEVEL, 7);
$ds = ldap_connect("ldaps://ldap.example.com:636");
ldap_bind($ds);
?>