宝塔环境安装LDAP扩展 分享链接

作者:禅道-Bee 最后编辑:禅道软件 于 2020-10-14 09:44:24 浏览量:2401

宝塔安装ldap扩展

1. 环境:

操作系统:centos8

[root@localhost ~]# cat /etc/redhat-release 
CentOS Linux release 8.0.1905 (Core) 
[root@localhost ~]# uname -r
4.18.0-80.el8.x86_64

宝塔:免费版 7.0.3

yum install -y wget && wget -O install.sh http://download.bt.cn/install/install_6.0.sh && sh install.sh
## 注意,安装的时候会提示选择安装目录,默认是 /wwww 目录,此处使用的默认路径

php:7.2.24

[root@localhost ~]# /www/server/php/72/bin/php -v
PHP 7.2.24 (cli) (built: Nov 12 2019 10:18:56) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies

2. 编译安装:

## 1. 进入程序编译目录,不同环境自己灵活调整
cd /www/server/php/72/src/ext/ldap/
## 2. 执行phpize命令
[root@localhost ldap]# /www/server/php/72/bin/phpize 
Configuring for:
PHP Api Version:         20170718
Zend Module Api No:      20170718
Zend Extension Api No:   320170718
## 3. 执行configure命令
[root@localhost ldap]# ./configure --with-php-config=/www/server/php/72/bin/php-config --with-ldap
## ************************************************************************* ###
## 若报错:configure: error: Cannot find ldap.h 执行以下
##   yum install openldapyum (提示没有这个包的话,可以忽略)
##   yum install openldap-devel
## ************************************************************************* ###
## 若报错:configure: error: Cannot find ldap libraries in /usr/lib 执行以下
##   cp -frp /usr/lib64/libldap* /usr/lib/
## ************************************************************************* ###
## 执行成功后,最后几行会提示:
##   checking whether stripping libraries is possible... yes
##   checking if libtool supports shared libraries... yes
##   checking whether to build shared libraries... yes
##   checking whether to build static libraries... no
##   
##   creating libtool
##   appending configuration tag "CXX" to libtool
##   configure: creating ./config.status
##   config.status: creating config.h
## 4. 编译安装 
[root@localhost ldap]# make & make install
## 执行后提示:
##   [root@localhost ldap]# make  && make install
##   /bin/sh /www/server/php/72/src/ext/ldap/libtool --mode=install cp ./ldap.la /www/server/php/72/src/ext/ldap/modules
##   cp ./.libs/ldap.so /www/server/php/72/src/ext/ldap/modules/ldap.so
##   cp ./.libs/ldap.lai /www/server/php/72/src/ext/ldap/modules/ldap.la
##   PATH="$PATH:/sbin" ldconfig -n /www/server/php/72/src/ext/ldap/modules
##   ----------------------------------------------------------------------
##   Libraries have been installed in:
##      /www/server/php/72/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/72/lib/php/extensions/no-debug-non-zts-20170718/
## 5. 开启php.ini中的ldap扩展,删除注释即可
##   897 ;extension=interbase
##   898 extension=ldap
##   899 ;extension=mbstring
##   900 ;extension=exif      ; Must be after mbstring as it depends on it
## "/www/server/php/72/etc/php.ini" 1950L, 72354C written
## 6. 面板重启php-fpm确认
[root@localhost ldap]# /www/server/php/72/bin/php -m | grep ldap
ldap