phpadldap

Adldap class Interface not found


<?php

include(dirname(__FILE__).'/Adldap.php');
use Adldap\Adldap;

$config = array(
        'account_suffix' => "@canoas.unilasalle.edu.br",

        'domain_controllers' => array("svr-dc01.canoas.unilasalle.edu.br"),

        'base_dn' => 'dc=canoas,dc=unilasalle,dc=edu,dc=br',

        'admin_username' => 'login',

        'admin_password' => '******',
    );

    $ad = new Adldap($config);
?>

Tried visiting Fatal error: Class 'adLDAP' not found, which worked, then I got this error after testing the class:

Fatal error: Class 'Adldap\Interfaces\ConnectionInterface' not found in C:\xampp\htdocs\ad\index.php on line 24

I don't know whats going on since the class Adldap.php does the includes.


Solution

  • If you downloaded the zip file of adLDAP from here (http://sourceforge.net/projects/adldap/files/adLDAP/adLDAP_4.0.4/adLDAP_4.0.4r2.zip/download), when you extract it it will have two folders, 'examples' and 'src'. Copy the entire src folder into your project where you currently have Adldap.php Then you can include(dirname(__FILE__).'/src/Adldap.php');, and the class should then have access to all of the other files it depends on.

    Or, as mentioned in the comment, use composer and follow the installation instructions here: https://github.com/adldap/adLDAP#installation.