Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // Set the ldap server
- $ldapurl = "[snipped]";
- $ldapuser = "[snipped]";
- $ldappass = "[snipped]";
- // Set the debug flag
- $debug = true;
- // Set debugging
- if ($debug) {
- ldap_set_option(NULL, LDAP_OPT_DEBUG_LEVEL, 7);
- }
- // connect to ldap server
- echo "Trying to connect<br/>";
- echo "1: " . date('l jS of F Y h:i:s A') . "<br/>";
- $ldapconn = ldap_connect($ldapurl) or die ("Couldn't connect");
- echo "2: " . date('l jS of F Y h:i:s A') . "<br/>";
- // binding to ldap server
- echo "Trying to bind with $ldapuser - $ldappass<br/>";
- echo "3: " . date('l jS of F Y h:i:s A') . "<br/>";
- $ldapbind = @ldap_bind($ldapconn, $ldapuser, $ldappass);
- echo "4: " . date('l jS of F Y h:i:s A') . "<br/>";
- if (!$ldapbind) {
- echo "Unable to bind to server $ldapurln";
- echo "OpenLdap error message: " . ldap_error($ldapconn) . "n";
- exit;
- }
- // Rest of code goes here
- ?>
- authconfig --enableldap --enableldapauth --forcelegacy=yes --ldapserver=myldapserver.com --ldapbasedn="dc=example,dc=com" --update
Add Comment
Please, Sign In to add comment