LDAP not working

In this board you can talk about general questions about phpMyFAQ

Moderator: Thorsten

Post Reply
rubberchicken
Posts: 1
Joined: Tue Aug 18, 2015 9:19 pm

LDAP not working

Post by rubberchicken »

Hello,

I'm trying to get the LDAP to work..but it keeps giving me this error:

Code: Select all

phpMyFAQ warning [2]: ldap_search(): Search: Operations error in C:\www\phpmyfaq\inc\PMF\Ldap.php on line 274
I figured from the login screen of PMF the inputted username/password would be used for LDAP auth once enabled and configured...but no luck.

Here is my LDAP config:

Code: Select all

$PMF_LDAP['ldap_server'] = 'ldapserver.domain';
$PMF_LDAP['ldap_port'] = 389;
$PMF_LDAP['ldap_user'] = '';
$PMF_LDAP['ldap_password'] = '';
$PMF_LDAP['ldap_base'] = 'dc=ad,dc=int';
constants_ldap:
$PMF_LDAP['ldap_use_domain_prefix'] = false;
$PMF_LDAP['ldap_use_anonymous_login'] = true;


I have LDAP working on my home made php script but not PHPMYFAQ (below is what works from my script):

Code: Select all

    $adServer = "ldapserver.domain";
	$port = 389;
	
    $ldap = ldap_connect($adServer, $port);
    $username = $_POST['username'];
    $password = $_POST['password'];

    $ldaprdn = 'ad' . "\\" . $username;

    ldap_set_option($ldap, LDAP_OPT_PROTOCOL_VERSION, 3);
    ldap_set_option($ldap, LDAP_OPT_REFERRALS, 0);

    $bind = @ldap_bind($ldap, $ldaprdn, $password);


    if ($bind) {
        $filter="(sAMAccountName=$username)";
        $result = ldap_search($ldap,"dc=ad,dc=int",$filter);
       
      echo "Success";
    } else {
      echo "Login failed";
   }
Thorsten
Posts: 15792
Joined: Tue Sep 25, 2001 11:14 am
Location: #phpmyfaq
Contact:

Re: LDAP not working

Post by Thorsten »

Hi,

do you see any errors in your AD server?

bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist
Post Reply