PHP configure not finding LDAP header libraries [closed]
I ran into this issue trying to get PHP extensions involved in a Docker container. Here is what I had to do:
apt-get install libldb-dev libldap2-dev
ln -s /usr/lib/x86_64-linux-gnu/libldap.so /usr/lib/libldap.so \ && ln -s /usr/lib/x86_64-linux-gnu/liblber.so /usr/lib/liblber.so
This worked for me perfectly.
Install LDAP libraries:
apt-get install libldb-dev
Create SO linker files:
updatedb --prunepaths=/mnt
cd /usr/lib
if [ ! -L liblber-2.4.so.2 ];
then
ln -s "$(locate liblber-2.4.so.2)"
fi
if [ ! -L liblber-2.4.so.2.8.3 ];
then
ln -s "$(locate liblber-2.4.so.2.8.3)"
fi
if [ ! -L liblber.so ];
then
ln -s "$(locate liblber.so)"
fi
if [ ! -L libldap.so ];
then
ln -s "$(locate libldap.so)"
fi
if [ ! -L libldap_r.so ];
then
ln -s "$(locate libldap_r.so)"
fi
Configure PHP:
./configure --with-ldap=/usr
The cleanest way to do it, according to this comment in the issues of the official PHP Docker image, is using libldap2-dev
(in Debian/Ubuntu) and calling configure
with --with-libdir=lib/x86_64-linux-gnu
.
PHP Version 5.6.20
debian and based:
su
aptitude install libldb-dev
ln -s /usr/lib/x86_64-linux-gnu/libldap.so /usr/lib/libldap.so
then, try to compile it
I had this same issue and none of the answers above helped. Then after some digging into PHP's configure file I found a different solution.
1) Check which lib directoriy you are using. If you use the switch --with-libdir=lib64
then you should have the libldap.so
and the other .so
files in /usr/lib64
. If you are not specifying a libdir then the .so
files should be in /usr/lib
. You can create symlinks if the .so
file are in a non-standard directory (like /usr/lib64
) but you dont want to specify the libdir.
2) Use the switch --with-ldap=yes
I wonder why this is not documented in the configure help.