进入之前编译安装php包中
cd ~/php7.1.21/ext/ldap
/usr/local/php/bin/phpize
./configure --with-php-config=/usr/local/php/bin/php-config --with-ldap
出错信息:
configure: error: Cannot find ldap.h
解决方法:
yum install -y openldap openldap-devel
出错信息:
configure: error: Cannot find ldap libraries in /usr/lib
解决方法:
cp -frp /usr/lib64/libldap* /usr/lib/
继续执行
./configure --with-php-config=/usr/local/php/bin/php-config --with-ldap
make && make install
安装完成后
修改php配置文件,将extension=ldap.so前的分号去掉,保存退出 并重启php-fpm
/etc/init.d/php-fpm restart
查看安装是否成功
/usr/local/php/bin/php -m