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/   是個軟連接來的)

[root@localhost ldap]# /usr/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 #等號后面的是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
        extension=ldap.so
#### 重啟php 使用 php -m查看模塊
 [root@mha-master ldap]# php -m

以上就是安裝的教程。

主要點有:

1.php必須是要編譯安裝的。否則無法找到ldap

2.依賴包必須提前安裝完成!

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM