欢迎各位兄弟 发布技术文章

这里的技术是共享的

You are here

自己亲自做的 linux php php_ldap ldap 扩展 centos7 php扩展安装 Ldap 有大用 有大大用 有大大大用 有大大大大用 有大大大大大用

centos7 php扩展安装 Ldap

这个问题搞了很久。

下面是安装教程。

1.安装 依赖包:

复制代码
 yum install openldap openldap-devel  -y

yum install gcc

yum install make

安装完成之后执行下面这句话

cp -frp /usr/lib64/libldap* /usr/lib/  #这步很重要
复制代码

 

 

2.进入php 源码包(因为php一定要编译的)

 1.进入php的源码路径:/www/server/php/71/src/ext/ldap    ( 我的是  /root/php-5.6.30/php-5.6.30/ext/ldap  )

2.执行phpize (一般都会在/usr/bin/   是个软连接来的)

复制代码
[root@localhost ldap]# /usr/bin/phpize   (我的是 /www/wdlinux/phps/56/bin/phpize )
Configuring for:
PHP Api Version: 20160303
Zend Module Api No: 20160303
Zend Extension Api No: 320160303

[root@localhost ldap]# ./configure --with-php-config=/www/server/php/71/bin/php-config  
(我的是  ./configure --with-php-config=/www/wdlinux/phps/56/bin/php-config )
#等号后面的是php安装位置路径
。。。。。。。。。。。 
creating libtool appending configuration tag
"CXX" to libtool
configure: creating .
/config.status config.status:
creating config.h (看到这里没有报错就开始编译)
[root@localhost ldap]#
make && make install #(开始编译安装)
。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。 Libraries have been installed
in: /www/server/php/71/src/ext/ldap/modules
If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and specify the full pathname of the library,
or use the `
-LLIBDIR' flag during linking and do at least one of the following: - add LIBDIR to the `LD_LIBRARY_PATH' environment variable during execution - add
LIBDIR to the `LD_RUN_PATH' environment variable during linking - use the `-Wl,--rpath -Wl,LIBDIR' linker flag - have your system administrator add LIBDIR to `/etc/ld.so.conf'
See any operating system documentation about shared libraries
for more information, such as the ld(1) and ld.so(8) manual pages.

---------------------------------------------------------------------- Build complete. Don't forget to run 'make test'.

Installing shared extensions: /www/server/php/71/lib/php/extensions/no-debug-non-zts-20160303/ #(看到以上就表示安装完成了。)
复制代码

3.找到php.ini  配置文件

最后在php.ini中添加扩展文件
 [root@mha-master ldap]# vim /usr/local/php/etc/php.ini   (我的是  vim /www/wdlinux/phps/56/etc/php.ini )
        extension=ldap.so
#### 重启php 使用 php -m查看模块
 [root@mha-master ldap]# php -m  (我的是 /www/wdlinux/phps/56/bin/php -m )

以上就是安装的教程。

主要点有:

1.php必须是要编译安装的。否则无法找到ldap

2.依赖包必须提前安装完成!

 


打开phpinfo()测试画面,查看如下画面即php的ldap扩展方法启用成功:

image.png


分类: PHPCentos7


来自  https://www.cnblogs.com/llxpbbs/articles/10920555.html


普通分类: