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.进入源码路径:/www/server/php/71/src/ext/ldap
2.执行phpize (一般都会在/usr/bin/ 是个软连接来的)
[[email protected] ldap]# /usr/bin/phpize Configuring for: PHP Api Version: 20160303 Zend Module Api No: 20160303 Zend Extension Api No: 320160303 [[email protected] ldap]# ./configure --with-php-config=/www/server/php/71/bin/php-config #等号后面的是php安装位置路径
。。。。。。。。。。。
creating libtool appending configuration tag "CXX" to libtool
configure: creating ./config.status config.status:
creating config.h (开到这里没有报错就开始编译)
[[email protected] 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中添加扩展文件 [[email protected]-master ldap]# vim /usr/local/php/etc/php.ini extension=ldap.so #### 重启php 使用 php -m查看模块 [[email protected]-master ldap]# php -m
以上就是安装的教程。
主要点有:
1.php必须是要编译安装的。否则无法找到ldap
2.依赖包必须提前安装完成!
转载于:https://www.cnblogs.com/llxpbbs/articles/10920555.html