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


## 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

 

转载于:https://www.cnblogs.com/reblue520/p/10181420.html

你可能感兴趣的:(php,数据库,memcached)