在已编译安装的
PHP
环境下安装
LDAP
模块
(其他模块也能以这个方式安装)
1、在PHP源码包内找到ldap模块文件
cd php-5.6.37
cd ext/ldap/
![2285b1e2d7af48a194b6346e3cdac2b93c82b946](https://yqfile.alicdn.com/2285b1e2d7af48a194b6346e3cdac2b93c82b946.png?x-oss-process=image/resize,w_1400/format,webp)
2、phpize命令是用来准备 PHP 扩展库的编译环境
phpize
./configure
make & make install
![edd397c8b4a31a59395130fe3bda325610407eb0](https://yqfile.alicdn.com/edd397c8b4a31a59395130fe3bda325610407eb0.png?x-oss-process=image/resize,w_1400/format,webp)
![0e66e7ddafb91c9d8b9ce1823544972bb49d09d3](https://yqfile.alicdn.com/0e66e7ddafb91c9d8b9ce1823544972bb49d09d3.png?x-oss-process=image/resize,w_1400/format,webp)
![719005b652cf1acad8d3c00880cda13e219b38a6](https://yqfile.alicdn.com/719005b652cf1acad8d3c00880cda13e219b38a6.png?x-oss-process=image/resize,w_1400/format,webp)
若报错configure:error: Cannot find ldap libraries in /usr/lib
执行cp -frp /usr/lib64/libldap* /usr/lib/ 再进行
make &make install
3、在php中的php.ini文件末尾添加extension=ldap.so
![a41c925c4766691f68acff1d9bc54f1f0c002019](https://yqfile.alicdn.com/a41c925c4766691f68acff1d9bc54f1f0c002019.png?x-oss-process=image/resize,w_1400/format,webp)
![d1ed787a824f245f6767f0e129a28e7fd5ce9baa](https://yqfile.alicdn.com/d1ed787a824f245f6767f0e129a28e7fd5ce9baa.png?x-oss-process=image/resize,w_1400/format,webp)
4、最后php –m 查看是否已经安装ldap模块成功
php -m
![5c42741cfa937b6a2cd43c134f35363fbfd10bcb](https://yqfile.alicdn.com/5c42741cfa937b6a2cd43c134f35363fbfd10bcb.png?x-oss-process=image/resize,w_1400/format,webp)
原文地址