2
<?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.

Community
  • 1
  • 1
Matheus
  • 880
  • 1
  • 7
  • 13
  • It is because you have only included the one file. The class uses other files as well. On the [GitHub page](https://github.com/adldap/adLDAP) there is a `composer.json` file. You should install and use [Composer](https://getcomposer.org/). – Sverri M. Olsen Jul 31 '15 at 20:39
  • I did use composer. The files have been updated, but the error persists. – Matheus Aug 03 '15 at 22:04
  • If you are using Composer then you would not need to include the file at all... have you included the autoloader file (`[ROOT]/vendor/autoload.php`) at the top of your main script? – Sverri M. Olsen Aug 04 '15 at 06:56
  • That oficially helped me to use the version, I am going to post an answer with the code. Thank you very much. – Matheus Aug 05 '15 at 18:23

1 Answers1

1

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.

Don't Panic
  • 41,125
  • 10
  • 61
  • 80
  • I have done that already, I got all files from the .rar. I extracted all contents from src folder. – Matheus Aug 03 '15 at 19:49
  • Ok, nice, that worked pretty well. But what about this version 5.0? I am sorry, but the version I tried was the 5.0 one, from github, it only worked when I downloaded this sourceforge version, which seems to be 4.0.4r2 – Matheus Aug 03 '15 at 22:45