PHP 配置找不到 LDAP 头库

Sha*_*lch 11 linux php ldap

我安装了 LDAP 开发标头:

apt-get install libldb-dev

这添加了一些 ldap 标头:

root@crunchbang:/usr/include# ls -la ldap*
-rw-r--r-- 1 root root  9466 Apr 23  2013 ldap_cdefs.h
-rw-r--r-- 1 root root  1814 Apr 23  2013 ldap_features.h
-rw-r--r-- 1 root root 65213 Apr 23  2013 ldap.h
-rw-r--r-- 1 root root  9450 Apr 23  2013 ldap_schema.h
-rw-r--r-- 1 root root  3468 Apr 23  2013 ldap_utf8.h
Run Code Online (Sandbox Code Playgroud)

当我配置和引用目录时:

./configure --with-ldap=/usr/include

我收到此错误:

...
checking for LDAP support... yes
checking for LDAP Cyrus SASL support... no
checking size of long int... 4
configure: error: Cannot find ldap libraries in /usr/include.
Run Code Online (Sandbox Code Playgroud)

小智 28

我在尝试将 PHP 扩展包含在 Docker 容器中时遇到了这个问题。这是我必须做的:

  1. apt-get install libldb-dev libldap2-dev
  2. 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


Sha*_*lch 9

这对我来说非常有效。

安装 LDAP 库:

apt-get install libldb-dev

创建 SO 链接器文件:

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
Run Code Online (Sandbox Code Playgroud)

配置PHP:

./configure --with-ldap=/usr


scy*_*scy 5

根据官方 PHP Docker 镜像问题中的评论libldap2-dev,最简洁的方法是使用(在 Debian/Ubuntu 中)并configure使用--with-libdir=lib/x86_64-linux-gnu.