centos7.6編譯安裝php7.2.11及redis/memcached/rabbitmq/openssl/curl等常見擴展


centos7.6編譯安裝php7.2.11及redis/memcached/rabbitmq/openssl/curl等常見擴展


獲取Php的編譯參數方法:
[root@eus-api-cms-backend-web01:~]# php -i |grep configure


./configure  --prefix=/usr/local/php-7.2.11_fpm --with-config-file-path=/usr/local/php-7.2.11_fpm/etc --with-openssl=/usr/local/lab/openssl-1.1.0i --with-libxml-dir=/usr --with-zlib-dir=/usr/local/lab/zlib-1.2.11 --with-bz2 --enable-calendar --with-curl=/usr/local/lab/curl-curl-7_62_0 --enable-dba --enable-exif --enable-ftp --with-jpeg-dir=/usr/local/lab/libjpeg-6b --with-png-dir=/usr/local/lab/libpng-1.6.10/ --with-freetype-dir=/usr/local/lab/freetype-2.5.4 --with-gd=/usr/local/lab/libgd-2.1.1 --with-gettext --enable-mbstring --with-ldap=/usr/local/openldap-2.4.23 --with-mcrypt=/usr/local/lab/libmcrypt-2.5.8 --with-mhash=/usr/local/lab/mhash-0.9.9.9 --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --with-unixODBC=/usr/local/lab/unixODBC-2.3.2 --with-pdo-dblib=/usr/local/lab/freetds-0.92 --enable-zip --with-iconv-dir=/usr/local/lab/libiconv-1.14 --with-fpm-user=apache --with-fpm-group=users --enable-fpm --with-xmlrpc --enable-soap --enable-mbregex --enable-opcache --enable-inline-optimization --enable-xml --enable-sockets --disable-debug --enable-pcntl --enable-shmop

一、編譯安裝各種常見擴展
擴展包的下載地址:
http://pecl.php.net/package-stats.php

# openssl的編譯(目前強烈不建議編譯安裝openssl-1.1.x,各種坑)
cd /usr/local/src && wget https://www.openssl.org/source/openssl-1.1.0i.tar.gz --no-check-certificate
tar -xzf /usr/local/lab/openssl-1.1.0i.tar.gz
cd /usr/local/lab/openssl-1.1.0i
./config --prefix=/usr/local/lab/openssl-1.1.0i
make && make install


# openssl-OpenSSL_1_0_2p編譯安裝
unzip openssl-OpenSSL_1_0_2p.zip
cd openssl-OpenSSL_1_0_2p
./config --prefix=/usr/local/lab/openssl-1.0.2p
make && make install

###event安裝記錄
wget http://pecl.php.net/get/event-2.4.2.tgz
tar -zxf event-2.4.2.tgz 
cd event-2.4.2
/usr/local/php/bin/phpize
./configure --with-event-core --with-event-extra --enable-event-debug  --with-php-config=/usr/local/php/bin/php-config
make && make install


# zlib編譯
cd /usr/local/src && wget http://www.zlib.net/zlib-1.2.11.tar.gz
tar -xvzf zlib-1.2.11.tar.gz
cd zlib-1.2.11
./configure --prefix=/usr/local/lab/zlib-1.2.11
make && make install

# curl的編譯(支持https)
unzip curl-curl-7_62_0.zip
cd /usr/local/src/curl-curl-7_62_0
./buildconf
./configure --prefix=/usr/local/lab/curl-7_62_0_ssl --with-ssl=/usr/local/lab/openssl-1.1.0i/ssl --with-gssapi --enable-tls-srp --with-libmetalink
make && make install


# 如果curl編譯https則libcurl報錯

[root@sz_yygl_cbs_test01_18_237:~]# cat test.php 
<?php
$params = array();

              $ch = curl_init();

              curl_setopt($ch, CURLOPT_URL, trim("https://www.baidu.com"));
              curl_setopt($ch, CURLOPT_VERBOSE, 1);
              /** turning off the server and peer verification(TrustManager Concept).*/
              curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
              curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
              curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
              curl_setopt($ch, CURLOPT_POST, 1);
              curl_setopt($ch, CURLOPT_TIMEOUT, 60);

              curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($params));

              $response = curl_exec($ch);
var_export($response);
              if (curl_errno($ch)) {
                      $curl_error = array();
                      $curl_error['errno'] = curl_errno($ch);
                      $curl_error['msg']      = curl_error($ch);
var_export($curl_error);
              }

              curl_close($ch);

[root@sz_yygl_cbs_test01_18_237:~]# php test.php 
* Protocol "https" not supported or disabled in libcurl
* Closing connection -1
falsearray (
  'errno' => 1,
  'msg' => 'Protocol "https" not supported or disabled in libcurl',


# 原因分析:php的擴展curl不支持https
解決:
unzip curl-curl-7_62_0.zip
cd /usr/local/src/curl-curl-7_62_0
./buildconf
# 編譯支持https的curl
./configure --prefix=/usr/local/lab/curl-7_62_0_ssl --with-gssapi --enable-tls-srp --with-libmetalink
make && make install

.....

config.status: creating libcurl.pc
config.status: creating lib/curl_config.h
config.status: executing depfiles commands
config.status: executing libtool commands
configure: Configured to build curl/libcurl:

  curl version:     7.62.0-DEV
  Host setup:       x86_64-unknown-linux-gnu
  Install prefix:   /usr/local/curl-7_62_0_ssl
  Compiler:         gcc
  # 表示支持openssl
  SSL support:      enabled (OpenSSL)
  SSH support:      no      (--with-libssh2)
  zlib support:     enabled
  brotli support:   no      (--with-brotli)
  GSS-API support:  enabled (MIT Kerberos/Heimdal)
  TLS-SRP support:  no      (--enable-tls-srp)
  resolver:         POSIX threaded
  IPv6 support:     no      (--enable-ipv6)
  Unix sockets support: enabled
  IDN support:      no      (--with-{libidn2,winidn})
  Build libcurl:    Shared=yes, Static=yes
  Built-in manual:  enabled
  --libcurl option: enabled (--disable-libcurl-option)
  Verbose errors:   enabled (--disable-verbose)
  SSPI support:     no      (--enable-sspi)
  ca cert bundle:   /etc/pki/tls/certs/ca-bundle.crt
  ca cert path:     no
  ca fallback:      no
  LDAP support:     no      (--enable-ldap / --with-ldap-lib / --with-lber-lib)
  LDAPS support:    no      (--enable-ldaps)
  RTSP support:     enabled
  RTMP support:     no      (--with-librtmp)
  metalink support: no      (--with-libmetalink)
  PSL support:      no      (libpsl not found)
  HTTP2 support:    disabled (--with-nghttp2)
  Protocols:        DICT FILE FTP FTPS GOPHER HTTP HTTPS IMAP IMAPS POP3 POP3S RTSP SMB SMBS SMTP SMTPS TELNET TFTP

################################################################################

# 安裝jpeg
#wget:http://ftp.gnu.org/gnu/libtool/libtool-2.2.6a.tar.gz
tar -zxf libtool-2.2.6a.tar.gz -C /usr/local/lab
cd /usr/local/lab/libtool-2.2.6
./configure
make && make install

然后進入jpeg-6b的源碼目錄,然后執行以下步驟,切記!COPY到當前目錄注意后面的點(.)
網上好多都把config.sub和config.guess的路徑弄錯了,應該是在/usr/share/libtool/config/下,而不是在
/usr/share/libtool/下

cd jpeg
cp /usr/share/libtool/config/config.sub .
cp /usr/share/libtool/config/config.guess .


mkdir -p /usr/local/libjpeg-6b/bin
mkdir -p /usr/local/libjpeg-6b/lib
mkdir -p /usr/local/libjpeg-6b/man/man1

./configure --prefix=/usr/local/libjpeg-6b --enable-shared --enable-static
make && make install

# 安裝freetype2.5.4
mkdir -p /usr/local/lab/freetype-2.5.4/include/freetype2/config
mkdir -p /usr/local/lab/freetype-2.5.4/include/freetype2/freetype/config
./configure --prefix=/usr/local/lab/freetype-2.5.4
make && make install


***************************************

# 編譯安裝 libmcrypt, mhash, mcrypt 二進制源碼包(這種方法只適合php7以下版本,對php7沒用)

# libmcrypt
tar -zxf libmcrypt-2.5.8.tar.gz 
cd libmcrypt-2.5.8
./configure --prefix=/usr/local/lab/libmcrypt-2.5.8_php7.2
make && make install

# mhash
tar -zxf mhash-0.9.9.9.tar.gz 
cd mhash-0.9.9.9
./configure --prefix=/usr/local/lab/mhash-0.9.9.9
make && make install

# mcrypt
tar -zxf mcrypt-2.6.8.tar.gz 
cd mcrypt-2.6.8

export LD_LIBRARY_PATH=/usr/local/lab/libmcrypt-2.5.8_php7.2/lib:/usr/local/lab/mhash-0.9.9.9/lib
export LDFLAGS="-L/usr/local/lab/mhash-0.9.9.9/lib -I/usr/local/lab/mhash-0.9.9.9/include/"
export CFLAGS="-I/usr/local/lab/mhash-0.9.9.9/include/"
./configure --prefix=/usr/local/lab/mcrypt-2.6.8 --with-libmcrypt-prefix=/usr/local/lab/libmcrypt-2.5.8_php7.2
make && make install

***************************************

# php7.2安裝mcrypt
tar -zxf mcrypt-1.0.1.tgz
cd mcrypt-1.0.1
# 在mcrypt-1.0.1目錄下執行phpize命令,會生成configure命令
[root@web01:/usr/local/src/mcrypt-1.0.1]# /usr/local/php-7.2.11_fpm/bin/phpize 
Configuring for:
PHP Api Version:         20170718
Zend Module Api No:      20170718
Zend Extension Api No:   320170718

[root@web01:/usr/local/src/mcrypt-1.0.1]# ./configure --with-php-config=/usr/local/php-7.2.11_fpm/bin/php-config

# php7.2.24安裝swoole擴展
# wget https://github.com/swoole/swoole-src/archive/v4.4.15.tar.gz
tar xf v4.4.15.tar.gz
cd swoole-src-4.4.15

# /usr/local/php-7.2.24_fpm/bin/phpize
# ./configure --with-php-config=/usr/local/php-7.2.24_fpm/bin/php-config
# make && make install
## Redis擴展
echo "*******************install Redis擴展 start*******************" cd /usr/local/src && wget http://pecl.php.net/get/redis-4.1.1.tgz tar -zxvf redis-4.1.1.tgz cd redis-4.1.1/ /usr/local/php/bin/phpize ./configure --with-php-config=/usr/local/php/bin/php-config make && make install ## SeasLog擴展 [root@web01:/usr/local/src]# tar -zxf SeasLog-1.8.6.tgz [root@web01:/usr/local/src]# cd SeasLog-1.8.6 [root@web01:/usr/local/src/SeasLog-1.8.6]# /usr/local/php-7.2.11_fpm/bin/phpize Configuring for: PHP Api Version: 20170718 Zend Module Api No: 20170718 Zend Extension Api No: 320170718 [root@web01:/usr/local/src/SeasLog-1.8.6]# ./configure --with-php-config=/usr/local/php-7.2.11_fpm/bin/php-config [root@web01:/usr/local/src/SeasLog-1.8.6]# make && make install ### memcached擴展 # 編譯安裝libmemcached-1.0.18 tar -zxf libmemcached-1.0.18.tar.gz cd libmemcached-1.0.18 ./configure --prefix=/usr/local/lab/libmemcached-1.0.18 --with-memcached # 安裝php-memcached擴展 php使用memcache的擴展有兩個,一個memcache,一個memcached,前者比較老,推薦使用第二個,我們這里以第二個為例: 在github上找到適用於php7的分支https://github.com/php-memcached-dev/php-memcached/tree/php7 # 解壓 unzip php-memcached-php7.zip cd php-memcached-php7 # 執行phpize會生成configure文件 /usr/local/php/bin/phpize # 執行預編譯 ./configure --enable-memcached --with-php-config=/usr/local/php/bin/php-config --with-libmemcached-dir=/usr/local/lab/libmemcached-1.0.18 --disable-memcached-sasl make && make install # 安裝rar擴展 tar -zxf rar-4.0.0.tgz cd rar-4.0.0 /usr/local/php/bin/phpize ./configure --with-php-config=/usr/local/php/bin/php-config make && make install ####安裝zmq擴展 1.到zeromq官網查看版本信息:http://zeromq.org/intro:get-the-software 2.Linux服務器跟目錄下依次執行以下命令: wget https://github.com/zeromq/libzmq/releases/download/v4.2.2/zeromq-4.2.5.tar.gz tar zxvf zeromq-4.2.5.tar.gz cd zeromq-4.2.5 ./configure make make install 3.切回根目錄,執行以下步驟: 下載https://codeload.github.com/mkoppanen/php-zmq/zip/master/php-zmq-master.zip unzip php-zmq-master.zip cd php-zmq-master /usr/local/php/bin/phpize ./configure --with-php-config=/usr/local/php/bin/php-config make make install # 編輯php配置文件,在最后面加入 # vim /usr/local/php/etc/php.ini extension=zmq.so # 編輯php.ini文件添加擴展,並重啟php-fpm extension=rar.so extension=memcache.so extension=memcached.so extension=redis.so extension=seaslog.so extension=pcntl.so extension=rar.so extension=mcrypt.so ###編譯安裝bcmath 1.進入PHP源碼包目錄下的ext/bcmath目錄 2.執行phpize命令,phpize命令在PHP安裝目錄的bin目錄下,如 /usr/local/php-7.2.11/bin/phpize 3.執行./configure --with-php-config=/usr/local/php-7.2.11_fpm/bin/php-config make && make install ####安裝 amqp擴展 # 安裝前要先安裝rabbitmq-c wget -c https://github.com/alanxz/rabbitmq-c/releases/download/v0.8.0/rabbitmq-c-0.8.0.tar.gz tar zxf rabbitmq-c-0.8.0.tar.gz cd rabbitmq-c-0.8.0 ./configure --prefix=/usr/local/rabbitmq-c-0.8.0 make && make install # 安裝amqp tar zxf amqp-1.9.3.tgz cd amqp-1.9.3 /usr/local/php/bin/phpize ./configure --with-php-config=/usr/local/php/bin/php-config --with-amqp --with-librabbitmq-dir=/usr/local/rabbitmq-c-0.8.0 make && make install # 安裝amqp的時候報錯: cc -I. -I/usr/local/src/amqp-1.9.3 -DPHP_ATOM_INC -I/usr/local/src/amqp-1.9.3/include -I/usr/local/src/amqp-1.9.3/main -I/usr/local/src/amqp-1.9.3 -I/usr/local/php-7.2.11_fpm/include/php -I/usr/local/php-7.2.11_fpm/include/php/main -I/usr/local/php-7.2.11_fpm/include/php/TSRM -I/usr/local/php-7.2.11_fpm/include/php/Zend -I/usr/local/php-7.2.11_fpm/include/php/ext -I/usr/local/php-7.2.11_fpm/include/php/ext/date/lib -I/usr/local/rabbitmq-c-0.8.0//include -DHAVE_CONFIG_H -g -O2 -c /usr/local/src/amqp-1.9.3/amqp_connection_resource.c -fPIC -DPIC -o .libs/amqp_connection_resource.o /usr/local/src/amqp-1.9.3/amqp_connection_resource.c:45:29: error: amqp_ssl_socket.h: No such file or directory /usr/local/src/amqp-1.9.3/amqp_connection_resource.c: In function ‘connection_resource_constructor’: /usr/local/src/amqp-1.9.3/amqp_connection_resource.c:409: warning: assignment makes pointer from integer without a cast make: *** [amqp_connection_resource.lo] Error 1 解決: 參考:https://github.com/alanxz/rabbitmq-c/issues/463 [root@sz_xx_cmsby01_11_99:/usr/local/src/amqp-1.9.3]# find /usr/local -name amqp_ssl_socket.h /usr/local/src/rabbitmq-c-0.8.0/librabbitmq/amqp_ssl_socket.h [root@sz_xx_cmsby01_11_99:/usr/local/src/amqp-1.9.3]# cp /usr/local/src/rabbitmq-c-0.8.0/librabbitmq/amqp_ssl_socket.h ./ # 重新make && make install 即可

####### 安裝imap擴展
# 安裝imap依賴

 
         

yum install -y libc-client-devel freetype-devel libcurl-devel libjpeg-turbo-devel openssl-devel libicu-devel libmcrypt-devel
ln -s /usr/lib64/libc-client.so /usr/lib/libc-client.so
cd /usr/local/src && tar -zxf php-7.2.11.tar.gz
cd /usr/local/src/php-7.2.11/ext/imap
/usr/local/php/bin/phpize
./configure --with-php-config=/usr/local/php/bin/php-config --with-imap=/usr/lib64 --with-imap-ssl --with-kerberos
make && make install

 
         


#####安裝mysql擴展
# 下載擴展地址,最上面最新的:http://git.php.net/?p=pecl/database/mysql.git;a=summary
unzip mysql-386776d.zip
cd mysql-386776d
/usr/local/php/bin/phpize
./configure --with-php-config=/usr/local/php/bin/php-config --with-mysql=mysqlnd
make && make install

 
         

# vim /usr/local/php-7.2.11_fpm/etc/php.ini
extension=mysql.so


# 安裝memcache擴展
unzip pecl-memcache-NON_BLOCKING_IO_php7.zip cd pecl-memcache-NON_BLOCKING_IO_php7 /usr/local/php/bin/phpize ./configure --with-php-config=/usr/local/php/bin/php-config make make install ### 安裝php7.2.11版本中自帶的擴展intl a.PHP intl 是國際化擴展,是ICU 庫的一個包裝器。所以在安裝PHP intl擴展前要先安裝ICU庫,安裝ICU庫的具體步驟: mkdir /usr/local/lab/icu cd /usr/local/lab/icu wget http://download.icu-project.org/files/icu4c/52.1/icu4c-52_1-src.tgz tar xf icu4c-52_1-src.tgz cd icu/source ./configure --prefix=/usr/local/lab/icu make && make install 安裝完畢: 注:icu版本你也可以去官網下載:http://site.icu-project.org/download  。--prefix=/usr/local/icu為icu的安裝路徑,也可以通過find /  -name  icu查找。 b.安裝擴展intl.so 1.進入php7源碼:cd /usr/local/src/php-7.2.11/ext/intl 2.運行:phpize ,找不到命令時,將路徑補全:/usr/local/php/bin/phpize(是php的安裝路徑),出現如下: [root@sz_xx_cmsby01_11_99:/usr/local/src/php-7.2.11/ext/intl]# /usr/local/php/bin/phpize Configuring for: PHP Api Version: 20170718 Zend Module Api No: 20170718 Zend Extension Api No: 320170718 c.運行配置 ./configure --enable-intl --with-icu-dir=/usr/local/lab/icu --with-php-config=/usr/local/php/bin/php-config make && make install 注:前面路徑為icu的安裝路徑,后面路徑為php的安裝路徑 二、編譯安裝php7.2.11 tar -zxf php-7.2.11.tar.gz cd php-7.2.11 ./configure --prefix=/usr/local/php-7.2.11_fpm --with-config-file-path=/usr/local/php-7.2.11_fpm/etc --with-openssl=/usr/local/lab/openssl-1.1.0i --with-libxml-dir=/usr --with-zlib-dir=/usr/local/lab/zlib-1.2.11 --with-bz2 --enable-calendar --with-curl=/usr/local/lab/curl-curl-7_62_0 --enable-dba --enable-exif --enable-ftp --with-jpeg-dir=/usr/local/lab/jpeg-9b --with-png-dir=/usr/local/lab/libpng-1.6.10/ --with-freetype-dir=/usr/local/lab/freetype-2.5.4 --with-gd=/usr/local/lab/libgd-2.1.1 --with-gettext --enable-mbstring --with-ldap=/usr/local/openldap-2.4.23 --with-mcrypt=/usr/local/lab/libmcrypt-2.5.8_php7.2 --with-mhash=/usr/local/lab/mhash-0.9.9.9 --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --with-unixODBC=/usr/local/lab/unixODBC-2.3.2 --with-pdo-dblib=/usr/local/lab/freetds-0.92 --enable-zip --with-iconv-dir=/usr/local/lab/libiconv-1.14 --with-fpm-user=apache --with-fpm-group=users --enable-fpm --with-xmlrpc --enable-soap --enable-mbregex --enable-opcache --enable-inline-optimization --enable-xml --enable-sockets --disable-debug --enable-pcntl --enable-shmop .... creating libtool appending configuration tag "CXX" to libtool Generating files configure: creating ./config.status creating main/internal_functions.c creating main/internal_functions_cli.c +--------------------------------------------------------------------+ | License: | | This software is subject to the PHP License, available in this | | distribution in the file LICENSE. By continuing this installation | | process, you are bound by the terms of this license agreement. | | If you do not agree with the terms of this license, you must abort | | the installation process at this point. | +--------------------------------------------------------------------+ Thank you for using PHP. config.status: creating php7.spec config.status: creating main/build-defs.h config.status: creating scripts/phpize config.status: creating scripts/man1/phpize.1 config.status: creating scripts/php-config config.status: creating scripts/man1/php-config.1 config.status: creating sapi/cli/php.1 config.status: creating sapi/fpm/php-fpm.conf config.status: creating sapi/fpm/www.conf config.status: creating sapi/fpm/init.d.php-fpm config.status: creating sapi/fpm/php-fpm.service config.status: creating sapi/fpm/php-fpm.8 config.status: creating sapi/fpm/status.html config.status: creating sapi/phpdbg/phpdbg.1 config.status: creating sapi/cgi/php-cgi.1 config.status: creating ext/phar/phar.1 config.status: creating ext/phar/phar.phar.1 config.status: creating main/php_config.h config.status: executing default commands configure: WARNING: unrecognized options: --with-mcrypt, --with-mysql # make && make install d/zend_exceptions.lo Zend/zend_strtod.lo Zend/zend_gc.lo Zend/zend_closures.lo Zend/zend_float.lo Zend/zend_string.lo Zend/zend_signal.lo Zend/zend_generators.lo Zend/zend_virtual_cwd.lo Zend/zend_ast.lo Zend/zend_objects.lo Zend/zend_object_handlers.lo Zend/zend_objects_API.lo Zend/zend_default_classes.lo Zend/zend_inheritance.lo Zend/zend_smart_str.lo Zend/zend_execute.lo main/internal_functions_cli.lo main/fastcgi.lo sapi/cgi/cgi_main.lo -lcrypt -lcrypto -lssl -lcrypto -lz -lcrypt -lrt -lsybdb -lldap -llber -lgd -lpng -lz -ljpeg -lpng -lz -ljpeg -lcrypto -lssl -lcrypto -lbz2 -lz -lcrypto -lssl -lcrypto -lrt -lm -ldl -lnsl -lrt -lxml2 -lz -lm -lcurl -lxml2 -lz -lm -lfreetype -lfreetype -lodbc -lxml2 -lz -lm -lxml2 -lz -lm -lcrypt -lxml2 -lz -lm -lxml2 -lz -lm -lxml2 -lz -lm -lxml2 -lz -lm -lcrypt -o sapi/cgi/php-cgi /usr/bin/ld: warning: libssl.so.6, needed by /usr/local/openldap-2.4.23/lib/libldap.so, may conflict with libssl.so.1.1 /usr/bin/ld: warning: libssl.so.6, needed by /usr/local/openldap-2.4.23/lib/libldap.so, may conflict with libssl.so.1.1 /usr/bin/ld: warning: libssl.so.6, needed by /usr/local/openldap-2.4.23/lib/libldap.so, may conflict with libssl.so.1.1 /usr/bin/ld: warning: libssl.so.6, needed by /usr/local/openldap-2.4.23/lib/libldap.so, may conflict with libssl.so.1.1 /usr/bin/ld: warning: libcrypto.so.6, needed by /usr/local/openldap-2.4.23/lib/libldap.so, may conflict with libcrypto.so.1.1 /usr/bin/ld: warning: libcrypto.so.6, needed by /usr/local/openldap-2.4.23/lib/libldap.so, may conflict with libcrypto.so.1.1 /usr/bin/ld: warning: libcrypto.so.6, needed by /usr/local/openldap-2.4.23/lib/libldap.so, may conflict with libcrypto.so.1.1 /usr/bin/ld: warning: libcrypto.so.6, needed by /usr/local/openldap-2.4.23/lib/libldap.so, may conflict with libcrypto.so.1.1 /usr/bin/ld: warning: libcrypto.so.6, needed by /usr/local/openldap-2.4.23/lib/libldap.so, may conflict with libcrypto.so.1.1 /usr/bin/ld: warning: libcrypto.so.6, needed by /usr/local/openldap-2.4.23/lib/libldap.so, may conflict with libcrypto.so.1.1 /usr/bin/ld: warning: libcrypto.so.6, needed by /usr/local/openldap-2.4.23/lib/libldap.so, may conflict with libcrypto.so.1.1 Generating phar.php Generating phar.phar PEAR package PHP_Archive not installed: generated phar will require PHP's phar extension be enabled. directorygraphiterator.inc invertedregexiterator.inc pharcommand.inc directorytreeiterator.inc clicommand.inc phar.inc Build complete. Don't forget to run 'make test'. Installing shared extensions: /usr/local/php-7.2.11_fpm/lib/php/extensions/no-debug-non-zts-20170718/ Installing PHP CLI binary: /usr/local/php-7.2.11_fpm/bin/ Installing PHP CLI man page: /usr/local/php-7.2.11_fpm/php/man/man1/ Installing PHP FPM binary: /usr/local/php-7.2.11_fpm/sbin/ Installing PHP FPM defconfig: /usr/local/php-7.2.11_fpm/etc/ Installing PHP FPM man page: /usr/local/php-7.2.11_fpm/php/man/man8/ Installing PHP FPM status page: /usr/local/php-7.2.11_fpm/php/php/fpm/ Installing phpdbg binary: /usr/local/php-7.2.11_fpm/bin/ Installing phpdbg man page: /usr/local/php-7.2.11_fpm/php/man/man1/ Installing PHP CGI binary: /usr/local/php-7.2.11_fpm/bin/ Installing PHP CGI man page: /usr/local/php-7.2.11_fpm/php/man/man1/ Installing build environment: /usr/local/php-7.2.11_fpm/lib/php/build/ Installing header files: /usr/local/php-7.2.11_fpm/include/php/ Installing helper programs: /usr/local/php-7.2.11_fpm/bin/ program: phpize program: php-config Installing man pages: /usr/local/php-7.2.11_fpm/php/man/man1/ page: phpize.1 page: php-config.1 Installing PEAR environment: /usr/local/php-7.2.11_fpm/lib/php/ [PEAR] Archive_Tar - installed: 1.4.3 [PEAR] Console_Getopt - installed: 1.4.1 [PEAR] Structures_Graph- installed: 1.1.1 [PEAR] XML_Util - installed: 1.4.2 [PEAR] PEAR - installed: 1.10.5 Wrote PEAR system config file at: /usr/local/php-7.2.11_fpm/etc/pear.conf You may want to add: /usr/local/php-7.2.11_fpm/lib/php to your php.ini include_path /usr/local/src/php-7.2.11/build/shtool install -c ext/phar/phar.phar /usr/local/php-7.2.11_fpm/bin ln -s -f phar.phar /usr/local/php-7.2.11_fpm/bin/phar Installing PDO headers: /usr/local/php-7.2.11_fpm/include/php/ext/pdo/ # 20181211重新編譯帶https的curl插件 tar -zxf php-7.2.11.tar.gz cd php-7.2.11 ./configure --prefix=/usr/local/php-7.2.11_fpm --with-config-file-path=/usr/local/php-7.2.11_fpm/etc --with-openssl=/usr/local/lab/openssl-1.0.2p --with-libxml-dir=/usr --with-zlib-dir=/usr/local/lab/zlib-1.2.11 --with-bz2 --enable-calendar --with-curl=/usr/local/lab/curl-7.36.0 --enable-dba --enable-exif --enable-ftp --with-jpeg-dir=/usr/local/lab/jpeg-9b --with-png-dir=/usr/local/lab/libpng-1.6.10/ --with-freetype-dir=/usr/local/lab/freetype-2.5.4 --with-gd=/usr/local/lab/libgd-2.1.1 --with-gettext --enable-mbstring --with-ldap=/usr/local/openldap-2.4.23 --with-mcrypt=/usr/local/lab/libmcrypt-2.5.8_php7.2 --with-mhash=/usr/local/lab/mhash-0.9.9.9 --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --with-unixODBC=/usr/local/lab/unixODBC-2.3.2 --with-pdo-dblib=/usr/local/lab/freetds-0.92 --enable-zip --with-iconv-dir=/usr/local/lab/libiconv-1.14 --with-fpm-user=apache --with-fpm-group=users --enable-fpm --with-xmlrpc --enable-soap --enable-mbregex --enable-opcache --enable-inline-optimization --enable-xml --enable-sockets --disable-debug --enable-pcntl --enable-shmop 1.編譯安裝完php后,要測試一個soap的支付接口,證明apiservice是可以使用的 測試soap的腳本 <?php $buy_url = 'https://api.avangate.com/order/2.0/soap/?wsdl'; //$buy_url = 'http://www.webxml.com.cn/WebServices/StockInfoWS.asmx?wsdl'; $options = array( 'cache_wsdl'=>WSDL_CACHE_NONE, ); try { $client = new SoapClient($buy_url, $options); } catch (\SoapFault $e) { $client = $e->getMessage(); } var_dump($client); # 運行后報錯: string(174) "SOAP-ERROR: Parsing WSDL: Couldn't load from 'https://api.avangate.com/order/2.0/soap/?wsdl' : failed to load external entity "https://api.avangate.com/order/2.0/soap/?wsdl" " 2.在網上找了很多方法,主流的方法都測試過了發現不行 比如關閉ssl驗證等 於是想快速yum安裝php7.2.11看是否是環境的問題,下面是安裝方法,安裝好以后發現問題依舊 a.安裝php最新rpm包的yum源 rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm b.通過yum方式安裝php7.2.11 yum -y install php72w php72w-cli php72w-common php72w-devel php72w-embedded php72w-fpm php72w-gd php72w-mbstring php72w-mysqlnd php72w-opcache php72w-pdo php72w-xml php72w-xmlrpc php72w-soap php72w-pear php72w-dba php72w-bcmatch php72w-ldap php72w-mysqlnd php72w-mbstring php72w-odbc php72w-pdo 3.看到一個引入nusoap的方法 nusoap是一個封裝了saop常用方法的類庫,直接引入就可以使用了 # 引入nusoap這個庫文件就可以搞定wsdl報錯,如下 [root@web01:/data/www/vhosts/film.wondershare.com/httpdocs/api/public]# cat printsoa.php <?php require_once("lib/nusoap.php"); $buy_url = 'https://api.avangate.com/order/2.0/soap/?wsdl'; $client = new nusoap_client($buy_url, "wsdl"); // 避免亂碼 $client->soap_defencoding = 'UTF-8'; $client->decode_utf8 = false; $client->xml_encoding = 'UTF-8'; $options = array( 'cache_wsdl'=>WSDL_CACHE_NONE, ); //$client->call('function_name', $options); var_dump($client); ?> https://sourceforge.net/projects/nusoap/files/nusoap/ 讓開發的同事研究一下使用方法應該就可以了 ################### # 測試openssl-1.0.2p版本編譯安裝Php7.2.11(推薦) tar -zxf php-7.2.11.tar.gz cd php-7.2.11 ./configure --prefix=/usr/local/php-7.2.11_fpm --with-config-file-path=/usr/local/php-7.2.11_fpm/etc --with-openssl=/usr/local/lab/openssl-1.0.2p --with-libxml-dir=/usr --with-zlib-dir=/usr/local/lab/zlib-1.2.11 --with-bz2 --enable-calendar --with-curl=/usr/local/lab/curl-curl-7_62_0 --enable-dba --enable-exif --enable-ftp --with-jpeg-dir=/usr/local/lab/jpeg-9b --with-png-dir=/usr/local/lab/libpng-1.6.10/ --with-freetype-dir=/usr/local/lab/freetype-2.5.4 --with-gd=/usr/local/lab/libgd-2.1.1 --with-gettext --enable-mbstring --with-ldap=/usr/local/openldap-2.4.23 --with-mhash=/usr/local/lab/mhash-0.9.9.9 --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --with-unixODBC=/usr/local/lab/unixODBC-2.3.2 --with-pdo-dblib=/usr/local/lab/freetds-0.92 --enable-zip --with-iconv-dir=/usr/local/lab/libiconv-1.14 --with-fpm-user=apache --with-fpm-group=users --enable-fpm --with-xmlrpc --enable-soap --enable-mbregex --enable-opcache --enable-inline-optimization --enable-xml --enable-sockets --disable-debug --enable-pcntl --enable-shmop # 使用系統默認的openssl編譯安裝php7.2.11 ./configure --prefix=/usr/local/php-7.2.11_fpm --with-config-file-path=/usr/local/php-7.2.11_fpm/etc --with-openssl --with-libxml-dir=/usr --with-zlib-dir=/usr/local/lab/zlib-1.2.11 --with-bz2 --enable-calendar --with-curl=/usr/local/lab/curl-curl-7_62_0 --enable-dba --enable-exif --enable-ftp --with-jpeg-dir=/usr/local/lab/jpeg-9b --with-png-dir=/usr/local/lab/libpng-1.6.10/ --with-freetype-dir=/usr/local/lab/freetype-2.5.4 --with-gd=/usr/local/lab/libgd-2.1.1 --with-gettext --enable-mbstring --with-ldap=/usr/local/openldap-2.4.23 --with-mhash=/usr/local/lab/mhash-0.9.9.9 --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --with-unixODBC=/usr/local/lab/unixODBC-2.3.2 --with-pdo-dblib=/usr/local/lab/freetds-0.92 --enable-zip --with-iconv-dir=/usr/local/lab/libiconv-1.14 --with-fpm-user=apache --with-fpm-group=users --enable-fpm --with-xmlrpc --enable-soap --enable-mbregex --enable-opcache --enable-inline-optimization --enable-xml --enable-sockets --disable-debug --enable-pcntl --enable-shmop

 

編譯安裝php7.2.30

# 編譯安裝php7.2.30
./configure --prefix=/usr/local/php7.2.30 --with-config-file-path=/usr/local/php7.2.30/etc --with-openssl=/usr/local/lab/openssl-1.0.2p --with-libxml-dir=/usr --with-zlib-dir=/usr/local/lab/zlib-1.2.11 --with-bz2 --enable-calendar --with-curl=/usr/local/lab/curl-7.36.0 --enable-dba --enable-exif --enable-ftp --with-jpeg-dir=/usr/local/lab/jpeg-9b --with-png-dir=/usr/local/lab/libpng-1.6.10/ --with-freetype-dir=/usr/local/lab/freetype-2.5.4 --with-gd=/usr/local/lab/libgd-2.1.1 --with-gettext --enable-mbstring --with-ldap=/usr/local/openldap-2.4.23 --with-mcrypt=/usr/local/lab/libmcrypt-2.5.8_php7.2 --with-mhash=/usr/local/lab/mhash-0.9.9.9 --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --with-unixODBC=/usr/local/lab/unixODBC-2.3.2 --with-pdo-dblib=/usr/local/lab/freetds-0.92 --enable-zip --with-iconv-dir=/usr/local/lab/libiconv-1.14 --with-fpm-user=apache --with-fpm-group=users --enable-fpm --with-xmlrpc --enable-soap --enable-mbregex --enable-opcache --enable-inline-optimization --enable-xml --enable-sockets --disable-debug --enable-pcntl --enable-shmop
# make && make install

# 報錯
/usr/bin/ld: cannot find -lpng12
collect2: error: ld returned 1 exit status
make: *** [sapi/cli/php] Error 1

# 解決辦法
yum install -y libpng12-devel

ldconfig

make clean
# make && make install

 


免責聲明!

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



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