LDAP extension issue in bitnami-lampstack-7.4.12 with php 7.4.12

Keywords: Drupal - Virtual Machines - Technical issue - Other
Description:
getting below error on doing ldap connection without adding php ldap extension :-

PHP Fatal error: Uncaught Error: Call to undefined function ldap_connect() in /root/ldap_test.php

I tried to manually install the ldap extension in my other linux server and copied the ldap.so file under extension folder in bitnami configurations and enabled ldap from the php.ini file.
After it running the same file getting below error:-

/data/lampstack/apache2/bin/httpd.bin: symbol lookup error: /data/lampstack/php/lib/php/extensions/ldap.so: undefined symbol: ldap_destroy

Please help we this issue as we are not able to launch without ldap integration

Hi @varuntit101m,

Thanks for using Bitnami. You don’t need to install any additional library on your system to use LDAP with PHP. The extension is already installed at /usr/lib/x86_64-linux-gnu/libldap_r-2.4.so.2.10.10. You can check that PHP was compiled with LDAP support using the next command

php -i | grep Configure -C4

I launched a fresh new LAMP 7.4.12 instance and this is the output I’m getting

$ php -i | grep Configure -C4
PHP Version => 7.4.12

System => Linux ip-172-31-23-170 4.19.0-12-cloud-amd64 #1 SMP Debian 4.19.152-1 (2020-10-18) x86_64
Build Date => Nov 25 2020 15:34:43
Configure Command =>  '/bitnami/blacksmith-sandox/php-7.4.12/configure'  '--prefix=/opt/bitnami/php' '--with-imap=/bitnami/blacksmith-sandox/imap-2007.0.0' '--with-imap-ssl' '--with-zlib-dir' '--with-zlib' '--with-libxml-dir=/usr' '--enable-soap' '--disable-rpath' '--enable-inline-optimization' '--with-bz2' '--enable-sockets' '--enable-pcntl' '--enable-exif' '--enable-bcmath' '--with-pdo-mysql=mysqlnd' '--with-mysqli=mysqlnd' '--with-png-dir=/usr' '--with-openssl' '--with-libdir=/lib/x86_64-linux-gnu' '--enable-ftp' '--enable-calendar' '--with-gettext' '--with-xmlrpc' '--with-xsl' '--enable-fpm' '--with-fpm-user=daemon' '--with-fpm-group=daemon' '--enable-mbstring' '--enable-cgi' '--enable-ctype' '--enable-session' '--enable-mysqlnd' '--enable-intl' '--with-iconv' '--with-pdo_sqlite' '--with-sqlite3' '--with-readline' '--with-gmp' '--with-curl' '--with-pdo-pgsql=shared' '--with-pgsql=shared' '--with-config-file-scan-dir=/opt/bitnami/php/etc/conf.d' '--enable-gd' '--with-pear' '--with-freetype' '--with-jpeg' '--with-zip' '--with-pdo-dblib=shared' '--with-tidy' '--with-ldap=/usr/' '--enable-apcu=shared'

As you can see, there is an LDAP reference at the end of the configure command

--with-ldap=/usr/

You can also check it is enabled by default using the next command

php -i | grep -i ldap -C1

The result for me is

$ php -i | grep -i ldap -C1
ldap

LDAP Support => enabled

Can you check it on your side? You will need to remove the ldap.so library you moved to your server

Hi @gongomgra

I ran the commands you provided but not able to see ldap configurations.

Please find attached screenshots for your reference.

Also my OS version is : RHEL V 7.9(Maipo)

Regards,
Varun

Hi @varuntit101,

Thanks for the info. As you are using RedHat Linux, I understand that you used one of our installers, is that correct? If so, can you tell us the exact name of the installer you used?

Can you also run the next command?

grep "base_stack_version" /data/lampstack/properties.ini

Hi @gongomgra

I downloaded LAMP 7.4.12-0 version from following link:-
https://bitnami.com/stack/lamp/installer

Also find attached image for the output of the command:-
image

Regards,
Varun Agarwal

Hi @varuntit101,

Thanks for the info. LDAP support for 7.4.x was added in a later release than the one you are using. Can you give the latest version a try? It is not possible to add LDAP support to the version you are currently using.

https://bitnami.com/stack/lamp/installer

Regards,
Gonzalo