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

README.md

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

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

just

$this->ldap->test();

eg:- for add user

$info["givenName"]="tets";
$info["sn"]=$user;
$info["uid"]="tets";
$info["mail"]="tets";
$info["displayName"]= "tets";
$info["gidNumber"] = 500;
$info["uidNumber"] = 500;
$info["homeDirectory"] = "/home/hasnan";
$info["cn"] = $user;
$info["userPassword"]="tets{sha}";
$info["objectclass"][0] = "top";
$info["objectclass"][1] = "person";
$info["objectclass"][2] = "inetOrgPerson";
$info["objectclass"][3] = "organizationalPerson";
$info["objectclass"][4] = "posixAccount";

$this->ldap->add_user($user,$info);

You can’t perform that action at this time.