CentOS   发布时间:2022-04-02  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了centos7.6编译安装php7.2.11及redis/memcached/rabbitmq/openssl/curl等常见扩展大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。

概述

centos7.6编译安装php7.2.11及redis/memcached/rabbitmq/openssl/curl等常见扩展 获取php的编译参数方法: [[email protected]-api-cms-BACkend-web01:~]# php -i |grep configure ./configure --prefix=/usr/local/php-7.2.
centos7.6编译安装PHP7.2.11及redis/memcached/rabbitmq/openssl/curl等常见扩展


获取PHP的编译参数方法:
[[email protected]-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
@H_3_24@make && @H_3_24@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
@H_3_24@make && @H_3_24@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
@H_3_24@make && @H_3_24@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
@H_3_24@make && @H_3_24@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
@H_3_24@make && @H_3_24@make install


# 如果curl编译https则libcurl报错

[[email protected]_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,CURLOPT_RETURNTRANSFER,1);
              curl_setopt($ch,CURLOPT_POST,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[@H_945_248@msg]      = curl_error($ch);
var_export($curl_error);
              }

              curl_close($ch);

[[email protected]_yygl_cbs_test01_18_237:~]# PHP test.PHP 
* Protocol "https" not supported or disabled in libcurl
* Closing connection -1
falsearray (
  errno => 1,@H_945_248@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
@H_3_24@make && @H_3_24@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
@H_3_24@make && @H_3_24@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 .


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

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

# 安装freetype2.5.4
@H_3_24@mkdir -p /usr/local/lab/freetype-2.5.4/include/freetype2/config
@H_3_24@mkdir -p /usr/local/lab/freetype-2.5.4/include/freetype2/freetype/config
./configure --prefix=/usr/local/lab/freetype-2.5.4
@H_3_24@make && @H_3_24@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
@H_3_24@make && @H_3_24@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
@H_3_24@make && @H_3_24@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
@H_3_24@make && @H_3_24@make install

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

# PHP7.2安装mcrypt
tar -zxf mcrypt-1.0.1.tgz
cd mcrypt-1.0.1
# 在mcrypt-1.0.1目录下执行PHPize命令,会生成configure命令
[[email protected]:/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

[[email protected]:/usr/local/src/mcrypt-1.0.1]# ./configure --with-PHP-config=/usr/local/PHP-7.2.11_fpm/bin/PHP-config


## 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
@H_3_24@make && @H_3_24@make install

## SeasLog扩展
[[email protected]:/usr/local/src]# tar -zxf SeasLog-1.8.6.tgz 
[[email protected]:/usr/local/src]# cd SeasLog-1.8.6
[[email protected]:/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
[[email protected]:/usr/local/src/SeasLog-1.8.6]# ./configure --with-PHP-config=/usr/local/PHP-7.2.11_fpm/bin/PHP-config
[[email protected]:/usr/local/src/SeasLog-1.8.6]# @H_3_24@make && @H_3_24@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-@H_740_22@memcached

# 安装PHP-@H_740_22@memcached扩展
PHP使用memcache的扩展有两个,@L_740_122@memcache,@L_740_122@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
@H_3_24@make && @H_3_24@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
@H_3_24@make && @H_3_24@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
@H_3_24@make
@H_3_24@make install

3.切回根目录,执行以下步骤:

下载https://codeload.github.com/mkoppanen/PHP-zmq/zip/master/PHP-zmq-master.zip
unzip PHP-zmq-master.zip
cd PHP-zmq-@H_740_22@master
/usr/local/PHP/bin/PHPize
./configure --with-PHP-config=/usr/local/PHP/bin/PHP-config
@H_3_24@make
@H_3_24@make install

# 编辑PHP配置文件,在最后面加入
# vim /usr/local/PHP/etc/PHP.ini

extension=zmq.so

# 编辑PHP.ini文件添加扩展,并重启PHP-fpm

extension=rar.so
extension=@H_740_22@memcache.so
extension=@H_740_22@memcached.so
extension=redis.so
extension=seaslog.so
extension=pcntl.so
extension=rar.so
extension=@H_740_22@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
@H_3_24@make && @H_3_24@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
@H_3_24@make && @H_3_24@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
@H_3_24@make && @H_3_24@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
@H_3_24@make: *** [amqp_connection_resource.lo] Error 1

解决:

参https://github.com/alanxz/rabbitmq-c/issues/463
[[email protected]_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
[[email protected]_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 && @H_3_24@make install 即可

# 安装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
@H_3_24@make
@H_3_24@make install

### 安装PHP7.2.11版本中自带的扩展intl

a.PHP intl 是国际化扩展,是ICU 库的一个包装器。所以在安装PHP intl扩展前要先安装ICU库,安装ICU库的具体步骤:

@H_3_24@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
@H_3_24@make && @H_3_24@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安装路径),出现如下:

[[email protected]_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
@H_3_24@make && @H_3_24@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


# @H_3_24@make && @H_3_24@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,may conflict with libssl.so.1.1
/usr/bin/ld: warning: libcrypto.so.6,may conflict with libcrypto.so.1.1
/usr/bin/ld: warning: libcrypto.so.6,may conflict with libcrypto.so.1.1
Generating phar.PHP
Generating phar.phar
PEAR package PHP_Archive not installed: generated phar will require PHPs phar extension be enabled.
directorygraphiterator.inc
invertedregexiterator.inc
pharcommand.inc
directorytreeiterator.inc
clicommand.inc
phar.inc

Build complete.
Dont forget to run @H_3_24@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 @H_3_24@man page:      /usr/local/PHP-7.2.11_fpm/PHP/@H_3_24@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 @H_3_24@man page:      /usr/local/PHP-7.2.11_fpm/PHP/@H_3_24@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 @H_3_24@man page:       /usr/local/PHP-7.2.11_fpm/PHP/@H_3_24@man/man1/
Installing PHP CGI binary:        /usr/local/PHP-7.2.11_fpm/bin/
Installing PHP CGI @H_3_24@man page:      /usr/local/PHP-7.2.11_fpm/PHP/@H_3_24@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 @H_3_24@man pages:             /usr/local/PHP-7.2.11_fpm/PHP/@H_3_24@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://@H_191_90@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报错,如下
[[email protected]:/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

大佬总结

以上是大佬教程为你收集整理的centos7.6编译安装php7.2.11及redis/memcached/rabbitmq/openssl/curl等常见扩展全部内容,希望文章能够帮你解决centos7.6编译安装php7.2.11及redis/memcached/rabbitmq/openssl/curl等常见扩展所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。