源碼安裝zabbix3.2.7時PHP ldap Warning

來源:互聯網
上載者:User

標籤:module   version   pre   源碼   tor   style   environ   解決方案   div   

問題如下:

解決方案:

1、首先查看源碼安裝的php模組中是否有ldap.so
[[email protected] ldap]# ll  /usr/local/php/lib/php/extensions/no-debug-non-zts-20160303/
total 1576
-rwxr-xr-x 1 root root  129484 Aug 22 10:18 ldap.so # 出現警示是因為此模組不存在,須要編譯產生此模組並重新載入
-rwxr-xr-x 1 root root 1430846 Aug 21 19:38 opcache.so
[[email protected] ldap]#

 

2、如何本機中已經有ldap.so,只須要在php.ini檔案中添加extension=ldap.so
    864 ; Dynamic Extensions ;    865 ;;;;;;;;;;;;;;;;;;;;;;    866     867 ; If you wish to have an extension loaded automatically, use the following    868 ; syntax:    869     extension=ldap.so          #新新增內容    870 ;       871 ;   extension=modulename.extension    872 ;     873 ; For example, on Windows:    874 ;       875 ;   extension=msql.dll    876 ;     877 ; ... or under UNIX:    878 ;       879 ;   extension=msql.so    880 ;     881 ; ... or with a path:    882 ;       883 ;   extension=/path/to/extension/msql.so    884 ; 

 

3、如果相應的模組不存在

  3.1下載相應的php版本源碼到主目錄,進行源碼編譯ldap模組(重點,其他模組如果缺失編譯方法一樣)

[[email protected] ~]# tar jxvf php-7.1.7.tar.bz2 [[email protected] ~]# lsanaconda-ks.cfg                  install.log         lnmp-install.log  php-7.1.7.tar.bz2databases_backup_20170821115223  install.log.syslog  php-7.1.7

[[email protected] ldap]# cd /root/php-7.1.7/ext/ldap/ #進入模組所在的源碼位置
[[email protected] ldap]# ll
total 144
-rw-rw-r-- 1 1000 1000   7374 Jul  6 17:30 config.m4
-rw-rw-r-- 1 1000 1000   1008 Jul  6 17:30 config.w32
-rw-rw-r-- 1 1000 1000     77 Jul  6 17:30 CREDITS
-rw-rw-r-- 1 1000 1000 102189 Jul  6 17:30 ldap.c
-rw-rw-r-- 1 1000 1000   4464 Jul  6 17:30 ldap.mak
-rw-rw-r-- 1 1000 1000   1546 Jul  6 17:30 LDAP_Win32_HOWTO.txt
-rw-rw-r-- 1 1000 1000   2315 Jul  6 17:30 php_ldap.h
drwxrwxr-x 2 1000 1000  12288 Jul  6 17:30 tests
[[email protected] ldap]# /usr/local/php/bin/phpize #編譯PHP擴充的工具,主要是根據系統資訊產生對應的configure檔案
Configuring for:
PHP Api Version:         20160303
Zend Module Api No:      20160303
Zend Extension Api No:   320160303
[[email protected] ldap]# ./configure  --with-php-config=/usr/local/php/bin/php-config  --with-ldap #編譯
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for a sed that does not truncate output... /bin/sed
........

[[email protected] ldap]# make && make install #安裝
/bin/sh /root/php-7.1.7/ext/ldap/libtool --mode=compile cc -DLDAP_DEPRECATED=1 -I. -I/root/php-7.1.7/ext/ldap -DPHP_ATOM_INC -I/root/php-7.1.7/ext/ldap/include -I/root/php-7.1.7/ext/ldap/main -I/root/php-7.1.7/ext/ldap -I/usr/local/php/include/php -I/usr/local/php/include/php/main -I/usr/local/php/include/php/TSRM -I/usr/local/php/include/php/Zend -I/usr/local/php/include/php/ext -I/usr/local/php/include/php/ext/date/lib  -DHAVE_CONFIG_H  -g -O2   -c /root/php-7.1.7/ext/ldap/ldap.c -o ldap.lo
mkdir .libs
 cc -DLDAP_DEPRECATED=1 -I. -I/root/php-7.1.7/ext/ldap -DPHP_ATOM_INC -I/root/php-7.1.7/ext/ldap/include -I/root/php-7.1.7/ext/ldap/main -I/root/php-7.1.7/ext/ldap -I/usr/local/php/include/php -I/usr/local/php/include/php/main -I/usr/local/php/include/php/TSRM -I/usr/local/php/include/php/Zend -I/usr/local/php/include/php/ext -I/usr/local/php/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /root/php-7.1.7/ext/ldap/ldap.c  -fPIC -DPIC -o .libs/ldap.o
/bin/sh /root/php-7.1.7/ext/ldap/libtool --mode=link cc -DPHP_ATOM_INC -I/root/php-7.1.7/ext/ldap/include -I/root/php-7.1.7/ext/ldap/main -I/root/php-7.1.7/ext/ldap -I/usr/local/php/include/php -I/usr/local/php/include/php/main -I/usr/local/php/include/php/TSRM -I/usr/local/php/include/php/Zend -I/usr/local/php/include/php/ext -I/usr/local/php/include/php/ext/date/lib  -DHAVE_CONFIG_H  -g -O2   -o ldap.la -export-dynamic -avoid-version -prefer-pic -module -rpath /root/php-7.1.7/ext/ldap/modules  ldap.lo -lldap -llber
cc -shared  .libs/ldap.o  -lldap -llber  -Wl,-soname -Wl,ldap.so -o .libs/ldap.so
creating ldap.la
(cd .libs && rm -f ldap.la && ln -s ../ldap.la ldap.la)
/bin/sh /root/php-7.1.7/ext/ldap/libtool --mode=install cp ./ldap.la /root/php-7.1.7/ext/ldap/modules
cp ./.libs/ldap.so /root/php-7.1.7/ext/ldap/modules/ldap.so
cp ./.libs/ldap.lai /root/php-7.1.7/ext/ldap/modules/ldap.la
PATH="$PATH:/sbin" ldconfig -n /root/php-7.1.7/ext/ldap/modules
----------------------------------------------------------------------
Libraries have been installed in:
   /root/php-7.1.7/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:     /usr/local/php/lib/php/extensions/no-debug-non-zts-20160303/ #make 產生模組安裝位置
[[email protected] ldap]#
[[email protected] php-7.1.7]# ll /usr/local/php/lib/php/extensions/no-debug-non-zts-20160303/ #確認ldap.so模組存在
total 1576
-rwxr-xr-x 1 root root  129484 Aug 22 10:18 ldap.so
-rwxr-xr-x 1 root root 1430846 Aug 21 19:38 opcache.so

[[email protected] php-7.1.7]# vi /usr/local/php/etc/php.ini #編輯php.ini,添加新產生的ldap.so模組

    853 default_socket_timeout = 60
    854
    855 ; If your scripts have to deal with files from Macintosh systems,
    856 ; or you are running on a Mac and need to deal with files from
    857 ; unix or win32 systems, setting this flag will cause PHP to
    858 ; automatically detect the EOL character in those files so that
    859 ; fgets() and file() will work regardless of the source of the file.
    860 ; http://php.net/auto-detect-line-endings
    861 ;auto_detect_line_endings = Off
    862
    863 ;;;;;;;;;;;;;;;;;;;;;;
    864 ; Dynamic Extensions ;
    865 ;;;;;;;;;;;;;;;;;;;;;;
    866
    867 ; If you wish to have an extension loaded automatically, use the following
    868 ; syntax:
    869     extension=ldap.so #新添加模組
    870 ;
    871 ;   extension=modulename.extension
    872 ;
    873 ; For example, on Windows:
    874 ;
    875 ;   extension=msql.dll
    876 ;
    877 ; ... or under UNIX:
    878 ;
    879 ;   extension=msql.so
    880 ;


[[email protected] php-7.1.7]# service httpd restart #重啟httpd
restart apache...  done

 

 4、http://192.168.0.198/zabbix/setup.php再次進入前端安裝  發現PHP LDAP模組 OK!! 5、至此zabbix 前面安裝 “Check of pre-requisites”全部OK

 

 

 

源碼安裝zabbix3.2.7時PHP ldap Warning

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.