Skip to content
codeigniter ldap class
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.
Ldap.php Update May 10, 2016

Using debian 8

Install open ldap

$apt-get install slapd ldap-utils

change /etc/ldap/ldap.conf for you base eg: dc=test,dc=com,dc=my

$dpkg-reconfigure slapd

install php5

$apt-get install php5 $apt-get install php5-ldap

install phpldap admin

$apt-get install phpldapadmin


codeigniter ldap class

for using this class , just put in /application/libraries

load in config/autoload.php

$autoload['libraries'] = array('ldap');

setting configure ldap

$config['ldap_server'] = 'localhost';
$config['ldap_port'] = '389';
$config['ldap_bs'] = 'dc=test,dc=com,dc=my';
$config['ldap_user'] = 'ou=users,dc=test,dc=com,dc=my';
$config['ldap_admin'] = 'cn=admin,dc=test,dc=com,dc=my';
$config['ldap_password'] = 'password';

you nead install openldap and set the ldap admin user and password first.

now you can call the class from controllers or models



eg:- for add user

$info["displayName"]= "tets";
$info["gidNumber"] = 500;
$info["uidNumber"] = 500;
$info["homeDirectory"] = "/home/hasnan";
$info["cn"] = $user;
$info["objectclass"][0] = "top";
$info["objectclass"][1] = "person";
$info["objectclass"][2] = "inetOrgPerson";
$info["objectclass"][3] = "organizationalPerson";
$info["objectclass"][4] = "posixAccount";


You can’t perform that action at this time.