(1)先安装openldap
# yum -y install openldap-devel openldap
# ln -sv /usr/lib64/libldap* /usr/lib/
(2)进入php的编译安装包目录下
# cd php-7.3.4/ext/ldap/
# /usr/local/php/bin/phpize
# ./configure --with-php-config=/usr/local/php/bin/php-config
# make && make install
安装后会输出ldap模块的目录,可以查看下是否生成“ldap.so”文件
# ls /usr/local/php/lib/php/extensions/no-debug-non-zts-20180731/
(3)编辑php配置文件,添加ldap模块,可添加到redis模块配置下,并重启apache生效
# vim /etc/php.ini
extension=ldap.so
# service httpd restart
(4)命令查看php模块,显示ldap则表示扩展安装成功
# /usr/local/edoc/php/bin/php -m|grep ldap
来源地址:https://blog.csdn.net/weixin_42272246/article/details/126894017