docker-library/drupal

Not able to install php-ldap module

Closed this issue · 1 comments

Hi, I have a container running of this drupal image. I am trying to implement windows authentication in Drupal site. For that I have installed some external drupal modules. But to enable those PHP-LDAP module is required. I am not able to install this module in the container. I am trying with command apt-get install php-ldap and apt-get install php8.0-ldap, however it's giving below error:
**Package php-ldap is a virtual package provided by:
php8.0-ldap 8.0.3-1 [Not candidate version]
php7.4-ldap 7.4.16-1 [Not candidate version]
php7.3-ldap 7.3.27-1deb10u1 [Not candidate version]
php7.3-ldap 7.3.19-1
deb10u1 [Not candidate version]

E: Package 'php-ldap' has no installation candidate**

Please help.

https://github.com/docker-library/docs/blob/master/php/README.md#e-package-php-xxx-has-no-installation-candidate

https://github.com/docker-library/docs/tree/master/drupal#adding-additional-libraries--extensions

$ docker build -t drupal:ldap - << EOF
FROM drupal
RUN apt update && apt install -y libldap2-dev && docker-php-ext-install ldap && rm -rf /var/lib/apt/lists/*
EOF

Sending build context to Docker daemon  2.048kB
Step 1/2 : FROM drupal
 ---> ef7cb65e0d90
Step 2/2 : RUN apt update && apt install -y libldap2-dev && docker-php-ext-install ldap && rm -rf /var/li
b/apt/lists/*
 ---> Running in 6dd089dd8057

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

Get:1 http://security.debian.org/debian-security buster/updates InRelease [65.4 kB]
Get:2 http://deb.debian.org/debian buster InRelease [122 kB]
Get:3 http://deb.debian.org/debian buster-updates InRelease [51.9 kB]
Get:4 http://security.debian.org/debian-security buster/updates/main amd64 Packages [268 kB]
Get:5 http://deb.debian.org/debian buster/main amd64 Packages [7907 kB]
Get:6 http://deb.debian.org/debian buster-updates/main amd64 Packages [9504 B]
Fetched 8423 kB in 2s (4310 kB/s)
Reading package lists...
Building dependency tree...
Reading state information...
1 package can be upgraded. Run 'apt list --upgradable' to see it.

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

Reading package lists...
Building dependency tree...
Reading state information...
The following NEW packages will be installed:
  libldap2-dev
0 upgraded, 1 newly installed, 0 to remove and 1 not upgraded.
Need to get 332 kB of archives.
After this operation, 1461 kB of additional disk space will be used.
Get:1 http://security.debian.org/debian-security buster/updates/main amd64 libldap2-dev amd64 2.4.47+dfsg-3+deb10u6 [332 kB]
debconf: delaying package configuration, since apt-utils is not installed
Fetched 332 kB in 0s (22.5 MB/s)
Selecting previously unselected package libldap2-dev:amd64.
(Reading database ... 13576 files and directories currently installed.)
Preparing to unpack .../libldap2-dev_2.4.47+dfsg-3+deb10u6_amd64.deb ...
Unpacking libldap2-dev:amd64 (2.4.47+dfsg-3+deb10u6) ...
Setting up libldap2-dev:amd64 (2.4.47+dfsg-3+deb10u6) ...
Configuring for:
PHP Api Version:         20200930
Zend Module Api No:      20200930
Zend Extension Api No:   420200930
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for a sed that does not truncate output... /bin/sed
checking for pkg-config... /usr/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking for cc... cc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether cc accepts -g... yes
checking for cc option to accept ISO C89... none needed
checking how to run the C preprocessor... cc -E
checking for icc... no
checking for suncc... no
checking for system library directory... lib
checking if compiler supports -R... no
checking if compiler supports -Wl,-rpath,... yes
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking target system type... x86_64-pc-linux-gnu
checking for PHP prefix... /usr/local
checking for PHP includes... -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib
checking for PHP extension directory... /usr/local/lib/php/extensions/no-debug-non-zts-20200930
checking for PHP installed headers prefix... /usr/local/include/php
checking if debug is enabled... no
checking if zts is enabled... no
checking for gawk... no
checking for nawk... nawk
checking if nawk is broken... no
checking for LDAP support... yes, shared
checking whether to build with LDAP Cyrus SASL support... no
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking size of long... 8
checking if we're at 64-bit platform... yes
checking for ANSI C header files... (cached) yes
checking for sys/types.h... (cached) yes
checking for sys/stat.h... (cached) yes
checking for stdlib.h... (cached) yes
checking for string.h... (cached) yes
checking for memory.h... (cached) yes
checking for strings.h... (cached) yes
checking for inttypes.h... (cached) yes
checking for stdint.h... (cached) yes
checking for unistd.h... (cached) yes
checking for 3 arg ldap_set_rebind_proc... yes
checking for ldap_parse_result... yes
checking for ldap_parse_reference... yes
checking for ldap_start_tls_s... yes
checking for ldap_control_find... yes
checking for ldap_parse_extended_result... yes
checking for ldap_extended_operation... yes
checking for ldap_extended_operation_s... yes
checking for ldap_passwd... yes
checking for ldap_whoami_s... yes
checking for ldap_refresh_s... yes
checking for ldap_bind_s... yes
checking for a sed that does not truncate output... /bin/sed
checking for ld used by cc... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for /usr/bin/ld option to reload object files... -r
checking for BSD-compatible nm... /usr/bin/nm -B
checking whether ln -s works... yes
checking how to recognize dependent libraries... pass_all
checking dlfcn.h usability... yes
checking dlfcn.h presence... yes
checking for dlfcn.h... yes
checking the maximum length of command line arguments... 1572864
checking command to parse /usr/bin/nm -B output from cc object... ok
checking for objdir... .libs
checking for ar... ar
checking for ranlib... ranlib
checking for strip... strip
checking if cc supports -fno-rtti -fno-exceptions... no
checking for cc option to produce PIC... -fPIC
checking if cc PIC flag -fPIC works... yes
checking if cc static flag -static works... yes
checking if cc supports -c -o file.o... yes
checking whether the cc linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... no

creating libtool
appending configuration tag "CXX" to libtool
configure: patching config.h.in
configure: creating ./config.status
config.status: creating config.h
/bin/bash /usr/src/php/ext/ldap/libtool --mode=compile cc -I. -I/usr/src/php/ext/ldap -I/usr/src/php/ext/ldap/include -I/usr/src/php/ext/ldap/main -I/usr/src/php/ext/ldap -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib  -fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DHAVE_CONFIG_H  -fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64   -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -c /usr/src/php/ext/ldap/ldap.c -o ldap.lo 
mkdir .libs
 cc -I. -I/usr/src/php/ext/ldap -I/usr/src/php/ext/ldap/include -I/usr/src/php/ext/ldap/main -I/usr/src/php/ext/ldap -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib -fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DHAVE_CONFIG_H -fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -c /usr/src/php/ext/ldap/ldap.c  -fPIC -DPIC -o .libs/ldap.o
/bin/bash /usr/src/php/ext/ldap/libtool --mode=link cc -shared -I/usr/src/php/ext/ldap/include -I/usr/src/php/ext/ldap/main -I/usr/src/php/ext/ldap -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib  -fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DHAVE_CONFIG_H  -fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64  -Wl,-O1 -pie  -o ldap.la -export-dynamic -avoid-version -prefer-pic -module -rpath /usr/src/php/ext/ldap/modules  ldap.lo -lldap -llber
cc -shared  .libs/ldap.o  -lldap -llber  -Wl,-O1 -Wl,-soname -Wl,ldap.so -o .libs/ldap.so
creating ldap.la
(cd .libs && rm -f ldap.la && ln -s ../ldap.la ldap.la)
/bin/bash /usr/src/php/ext/ldap/libtool --mode=install cp ./ldap.la /usr/src/php/ext/ldap/modules
cp ./.libs/ldap.so /usr/src/php/ext/ldap/modules/ldap.so
cp ./.libs/ldap.lai /usr/src/php/ext/ldap/modules/ldap.la
PATH="$PATH:/sbin" ldconfig -n /usr/src/php/ext/ldap/modules
----------------------------------------------------------------------
Libraries have been installed in:
   /usr/src/php/ext/ldap/modules

If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR'
flag during linking and do at least one of the following:
   - add LIBDIR to the `LD_LIBRARY_PATH' environment variable
     during execution
   - add LIBDIR to the `LD_RUN_PATH' environment variable
     during linking
   - use the `-Wl,--rpath -Wl,LIBDIR' linker flag
   - have your system administrator add LIBDIR to `/etc/ld.so.conf'

See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
----------------------------------------------------------------------

Build complete.
Don't forget to run 'make test'.

Installing shared extensions:     /usr/local/lib/php/extensions/no-debug-non-zts-20200930/
find . -name \*.gcno -o -name \*.gcda | xargs rm -f
find . -name \*.lo -o -name \*.o | xargs rm -f
find . -name \*.la -o -name \*.a | xargs rm -f
find . -name \*.so | xargs rm -f
find . -name .libs -a -type d|xargs rm -rf
rm -f libphp.la      modules/* libs/*
rm -f ext/opcache/jit/zend_jit_x86.c
Removing intermediate container 6dd089dd8057
 ---> 1c548bcfc0c0
Successfully built 1c548bcfc0c0
Successfully tagged drupal:ldap
$ docker run --rm drupal:ldap php -i 2>&1 | grep -i ldap
/usr/local/etc/php/conf.d/docker-php-ext-ldap.ini,
Protocols => dict, file, ftp, ftps, gopher, http, https, imap, imaps, ldap, ldaps, pop3, pop3s, rtmp, rtsp, scp, sftp, smb, smbs, smtp, smtps, telnet, tftp
ldap
LDAP Support => enabled
Vendor Name => OpenLDAP
ldap.max_links => Unlimited => Unlimited