Search code examples
classldapcomposer-php

Adldap2 : Uncaught Error: Class 'Adldap\Adldap' not found


I'm trying to install Adldap2 (not the Laravel version) with composer but I get an error message.

Composer version :

2.2.18

I think that there is no installation error : enter image description here

Error :

Fatal error: Uncaught Error: Class 'Adldap\Adldap' not found in /var/www/html/test.php:17 Stack trace: #0 {main} thrown in /var/www/html/test.php on line 17

Code :

<?php
ini_set('display_errors','on'); error_reporting(E_ALL);

require __DIR__ . '/vendor/autoload.php';

$config = [
    'hosts'            => ['xxx.local'],
    'base_dn'          => 'dc=xxx,dc=localg',
    'username'         => 'xxx',
    'password'         => 'xxx',

    'custom_options'   => [
        LDAP_OPT_X_TLS_REQUIRE_CERT => LDAP_OPT_X_TLS_HARD
    ]
];

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

Anyone know why I get this error ?


Solution

  • Looked in the /var/www/html/vendor/ folder and noticed that my package adldap2/adldap2 was not in (thanks @Nico Hasse). So I searched for a "ldap" folder in all my files and noticed that it was installed in /vendor/ folder

    I was in my root folder instead of my project folder /var/www/html/ I moved to my project folder and launch back the package installation and it worked.