How do I add PHP-LDAP to a Docker Container

6,254

MediaWiki does not provide any PHP extensions. You have to write your own docker file and use the below helpers to install ldap extension and build the image from it :

FROM mediawiki:<version>
RUN \ 
apt-get update && \
apt-get install libldap2-dev -y && \
rm -rf /var/lib/apt/lists/* && \
docker-php-ext-configure ldap --with-libdir=lib/x86_64-linux-gnu/ && \
docker-php-ext-install ldap
Share:
6,254

Related videos on Youtube

Simini W
Author by

Simini W

Updated on September 18, 2022

Comments

  • Simini W
    Simini W over 1 year

    I installed a MediaWiki on a Docker in CentOS 8. I want to integrate LDAP. I installed the LDAP extensions and activated it in the LocalSettings.php file. Now, when I try to login in my wiki I get this error:

    [c04f74d86c621c5c996ce413] /index.php/Spezial:PluggableAuthLogin Error from line 244 of /var/www/html/extensions/LDAPProvider/src/PlatformFunctionWrapper.php: Call to undefined function ldap_connect()
    

    I searched for a solution the last 5 daysand I'm finding nothing that helps me. I read that I have to install PHP-LDAP in the Docker container, but how can I do that?

    • Alexander Mashin
      Alexander Mashin over 3 years
      You should activate LDAP PHP extension in PHP configuration.
    • Simini W
      Simini W over 3 years
      How can I do that? I'm sorry, I'm new to Linux and the other stuff.
    • Alexander Mashin
      Alexander Mashin over 3 years
      If it were a real machine, it would be sudo yum install php7.4-ldap && sudo phpenmod ldap && sudo service php7.4-fpm restart assuming you use PHP 7.4 an php-fpm. But for Docker, I can't advise you.
  • Admin
    Admin almost 2 years
    Thank you for the lines but I do get an error: #20 0.284 E: Unable to locate package libldap2-dev. I am using FROM php:7.2-apache