Error: Class 'Symfony\\Component\\Ldap\\Ldap' not found on Drupal 9

Created on 7 June 2020, about 4 years ago
Updated 12 May 2023, about 1 year ago

Short description:
Problem: after installing ldap-8.x-4.0-alpha1.zip on Drupal 9.0.0, the site is not accessible anymore and the message proposed is "The website encountered an unexpected error. Please try again later".

Details:
I have installed Drupal 9.0.0 on an Apache2, Mysql 5.7.30, PHP 7.3.18-1+ubuntu16.04.1+deb.sury.org+1 configuration.
During the installation, I have selected "Minimal" configuration.

I am looking for a solution to implement LDAP integration.
I am not sure I can install Drupal 8 modules on it.

To date, there is no Drupal LDAP module version labeled 9.x.
The last version available is 8.x-4.x-dev.

Before I have tried with ldap-8.x-3.0-beta7.zip. However, the module was not recognized as a valid module for Drupal 9, so I moved to the next version.
Thus, I have installed ldap-8.x-4.0-alpha1.zip (based on Symfony), which on the contrary is recognized as a valid module for Drupal 9.

As the LDAP server to integrate within on the same OS,
I have copied/pasted most of the configuration from D7 installation to D9 installation.
In the same way, I have configured the other info (Servers, User settings, Drupal mappings, LDAP mappings, Authentication) and then saved the LDAP server in D9.

The site is not accessible anymore and the message proposed is "The website encountered an unexpected error. Please try again later".

Accessing the Apache 2 Error log, I find:

[Sun Jun 07 12:34:36.748611 2020] [php7:notice] [pid 16476] [client 81.247.179.41:60584] Error: Class 'Symfony\\Component\\Ldap\\Ldap' not found in renamed_path/drupal-9.0.0/sites/all/modules/ldap/ldap_servers/src/LdapBridge.php on line 103 #0 renamed_path/drupal-9.0.0/sites/all/modules/ldap/ldap_servers/src/ServerListBuilder.php(86): Drupal\\ldap_servers\\LdapBridge->setServer(Object(Drupal\\ldap_servers\\Entity\\Server))
#1 renamed_path/drupal-9.0.0/sites/all/modules/ldap/ldap_servers/src/ServerListBuilder.php(54): Drupal\\ldap_servers\\ServerListBuilder->checkStatus(Object(Drupal\\ldap_servers\\Entity\\Server))
#2 renamed_path/drupal-9.0.0/core/lib/Drupal/Core/Entity/EntityListBuilder.php(218): Drupal\\ldap_servers\\ServerListBuilder->buildRow(Object(Drupal\\ldap_servers\\Entity\\Server))
#3 renamed_path/drupal-9.0.0/core/lib/Drupal/Core/Entity/Controller/EntityListController.php(23): Drupal\\Core\\Entity\\EntityListBuilder->render()
#4 [internal function]: Drupal\\Core\\Entity\\Controller\\EntityListController->listing('ldap_server')
#5 renamed_path/drupal-9.0.0/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(123): call_user_func_array(Array, Array)
#6 renamed_path/drupal-9.0.0/core/lib/Drupal/Core/Render/Renderer.php(573): Drupal\\Core\\EventSubscriber\\EarlyRenderingControllerWrapperSubscriber->Drupal\\Core\\EventSubscriber\\{closure}()
#7 renamed_path/drupal-9.0.0/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(124): Drupal\\Core\\Render\\Renderer->executeInRenderContext(Object(Drupal\\Core\\Render\\RenderContext), Object(Closure))
#8 renamed_path/drupal-9.0.0/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(97): Drupal\\Core\\EventSubscriber\\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array)
#9 renamed_path/drupal-9.0.0/vendor/symfony/http-kernel/HttpKernel.php(158): Drupal\\Core\\EventSubscriber\\EarlyRenderingControllerWrapperSubscriber->Drupal\\Core\\EventSubscriber\\{closure}()
#10 renamed_path/drupal-9.0.0/vendor/symfony/http-kernel/HttpKernel.php(80): Symfony\\Component\\HttpKernel\\HttpKernel->handleRaw(Object(Symfony\\Component\\HttpFoundation\\Request), 1)
#11 renamed_path/drupal-9.0.0/core/lib/Drupal/Core/StackMiddleware/Session.php(57): Symfony\\Component\\HttpKernel\\HttpKernel->handle(Object(Symfony\\Component\\HttpFoundation\\Request), 1, true)
#12 renamed_path/drupal-9.0.0/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(47): Drupal\\Core\\StackMiddleware\\Session->handle(Object(Symfony\\Component\\HttpFoundation\\Request), 1, true)
#13 renamed_path/drupal-9.0.0/core/modules/page_cache/src/StackMiddleware/PageCache.php(106): Drupal\\Core\\StackMiddleware\\KernelPreHandle->handle(Object(Symfony\\Component\\HttpFoundation\\Request), 1, true)
#14 renamed_path/drupal-9.0.0/core/modules/page_cache/src/StackMiddleware/PageCache.php(85): Drupal\\page_cache\\StackMiddleware\\PageCache->pass(Object(Symfony\\Component\\HttpFoundation\\Request), 1, true)
#15 renamed_path/drupal-9.0.0/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(47): Drupal\\page_cache\\StackMiddleware\\PageCache->handle(Object(Symfony\\Component\\HttpFoundation\\Request), 1, true)
#16 renamed_path/drupal-9.0.0/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(52): Drupal\\Core\\StackMiddleware\\ReverseProxyMiddleware->handle(Object(Symfony\\Component\\HttpFoundation\\Request), 1, true)
#17 renamed_path/drupal-9.0.0/vendor/stack/builder/src/Stack/StackedHttpKernel.php(23): Drupal\\Core\\StackMiddleware\
egotiationMiddleware->handle(Object(Symfony\\Component\\HttpFoundation\\Request), 1, true)
#18 renamed_path/drupal-9.0.0/core/lib/Drupal/Core/DrupalKernel.php(705): Stack\\StackedHttpKernel->handle(Object(Symfony\\Component\\HttpFoundation\\Request), 1, true)
#19 renamed_path/drupal-9.0.0/index.php(19): Drupal\\Core\\DrupalKernel->handle(Object(Symfony\\Component\\HttpFoundation\\Request))
#20 {main}, referer: https://www.changed_domain.com/admin/config/people/ldap/authentication

(as a minor bug, the output includes "\n" code, but no new lines, here I have replaced for clarity)

What could I do to restore the installation, different than disable the module on the DB?
Could I install Symfony? How?

💬 Support request
Status

Closed: won't fix

Component

Code

Created by

🇮🇹Italy francesco.mattu

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇳🇴Norway mflage

    Would if we could:

    ./composer.json has been updated
    Running composer update drupal/ldap
    Loading composer repositories with package information
    Updating dependencies
    Your requirements could not be resolved to an installable set of packages.
    
      Problem 1
        - Root composer.json requires drupal/ldap ^4.3 -> satisfiable by drupal/ldap[4.3.0].
        - drupal/ldap 4.3.0 requires drupal/authorization ^1.0 -> found drupal/authorization[dev-1.x, 1.0.0-beta1, ..., 1.x-dev (alias of dev-1.x)] but it does not match your minimum-stability.
    
    
    Installation failed, reverting ./composer.json and ./composer.lock to their original content.
Production build 0.69.0 2024