1. centos7.6编译安装php7..11redis/memcached/rabbitmq/openssl/curl等常见扩展
  2.  
  3. 获取Php的编译参数方法:
  4. [root@eus-api-cms-backend-web01:~]# php -i |grep configure
  5.  
  6. ./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. --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./ --with-freetype-dir=/usr/local/lab/freetype-2.5. --with-gd=/usr/local/lab/libgd-2.1. --with-gettext --enable-mbstring --with-ldap=/usr/local/openldap-2.4. --with-mcrypt=/usr/local/lab/libmcrypt-2.5. --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. --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
  7.  
  8. 一、编译安装各种常见扩展
  9. 扩展包的下载地址:
  10. http://pecl.php.net/package-stats.php
  11.  
  12. # openssl的编译(目前强烈不建议编译安装openssl-1.1.x,各种坑)
  13. cd /usr/local/src && wget https://www.openssl.org/source/openssl-1.1.0i.tar.gz --no-check-certificate
  14. tar -xzf /usr/local/lab/openssl-1.1.0i.tar.gz
  15. cd /usr/local/lab/openssl-1.1.0i
  16. ./config --prefix=/usr/local/lab/openssl-1.1.0i
  17. make && make install
  18.  
  19. # openssl-OpenSSL_1_0_2p编译安装
  20. unzip openssl-OpenSSL_1_0_2p.zip
  21. cd openssl-OpenSSL_1_0_2p
  22. ./config --prefix=/usr/local/lab/openssl-1.0.2p
  23. make && make install
  24.  
  25. ###event安装记录
  26. wget http://pecl.php.net/get/event-2.4.2.tgz
  27. tar -zxf event-2.4..tgz
  28. cd event-2.4.
  29. /usr/local/php/bin/phpize
  30. ./configure --with-event-core --with-event-extra --enable-event-debug --with-php-config=/usr/local/php/bin/php-config
  31. make && make install
  32.  
  33. # zlib编译
  34. cd /usr/local/src && wget http://www.zlib.net/zlib-1.2.11.tar.gz
  35. tar -xvzf zlib-1.2..tar.gz
  36. cd zlib-1.2.
  37. ./configure --prefix=/usr/local/lab/zlib-1.2.
  38. make && make install
  39.  
  40. # curl的编译(支持https)
  41. unzip curl-curl-7_62_0.zip
  42. cd /usr/local/src/curl-curl-7_62_0
  43. ./buildconf
  44. ./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
  45. make && make install
  46.  
  47. # 如果curl编译https则libcurl报错
  48.  
  49. [root@sz_yygl_cbs_test01_18_237:~]# cat test.php
  50. <?php
  51. $params = array();
  52.  
  53. $ch = curl_init();
  54.  
  55. curl_setopt($ch, CURLOPT_URL, trim("https://www.baidu.com"));
  56. curl_setopt($ch, CURLOPT_VERBOSE, );
  57. /** turning off the server and peer verification(TrustManager Concept).*/
  58. curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
  59. curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
  60. curl_setopt($ch, CURLOPT_RETURNTRANSFER, );
  61. curl_setopt($ch, CURLOPT_POST, );
  62. curl_setopt($ch, CURLOPT_TIMEOUT, );
  63.  
  64. curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($params));
  65.  
  66. $response = curl_exec($ch);
  67. var_export($response);
  68. if (curl_errno($ch)) {
  69. $curl_error = array();
  70. $curl_error['errno'] = curl_errno($ch);
  71. $curl_error['msg'] = curl_error($ch);
  72. var_export($curl_error);
  73. }
  74.  
  75. curl_close($ch);
  76.  
  77. [root@sz_yygl_cbs_test01_18_237:~]# php test.php
  78. * Protocol "https" not supported or disabled in libcurl
  79. * Closing connection -
  80. falsearray (
  81. 'errno' => ,
  82. 'msg' => 'Protocol "https" not supported or disabled in libcurl',
  83.  
  84. # 原因分析:php的扩展curl不支持https
  85. 解决:
  86. unzip curl-curl-7_62_0.zip
  87. cd /usr/local/src/curl-curl-7_62_0
  88. ./buildconf
  89. # 编译支持https的curl
  90. ./configure --prefix=/usr/local/lab/curl-7_62_0_ssl --with-gssapi --enable-tls-srp --with-libmetalink
  91. make && make install
  92.  
  93. .....
  94.  
  95. config.status: creating libcurl.pc
  96. config.status: creating lib/curl_config.h
  97. config.status: executing depfiles commands
  98. config.status: executing libtool commands
  99. configure: Configured to build curl/libcurl:
  100.  
  101. curl version: 7.62.-DEV
  102. Host setup: x86_64-unknown-linux-gnu
  103. Install prefix: /usr/local/curl-7_62_0_ssl
  104. Compiler: gcc
  105. # 表示支持openssl
  106. SSL support: enabled (OpenSSL)
  107. SSH support: no (--with-libssh2)
  108. zlib support: enabled
  109. brotli support: no (--with-brotli)
  110. GSS-API support: enabled (MIT Kerberos/Heimdal)
  111. TLS-SRP support: no (--enable-tls-srp)
  112. resolver: POSIX threaded
  113. IPv6 support: no (--enable-ipv6)
  114. Unix sockets support: enabled
  115. IDN support: no (--with-{libidn2,winidn})
  116. Build libcurl: Shared=yes, Static=yes
  117. Built-in manual: enabled
  118. --libcurl option: enabled (--disable-libcurl-option)
  119. Verbose errors: enabled (--disable-verbose)
  120. SSPI support: no (--enable-sspi)
  121. ca cert bundle: /etc/pki/tls/certs/ca-bundle.crt
  122. ca cert path: no
  123. ca fallback: no
  124. LDAP support: no (--enable-ldap / --with-ldap-lib / --with-lber-lib)
  125. LDAPS support: no (--enable-ldaps)
  126. RTSP support: enabled
  127. RTMP support: no (--with-librtmp)
  128. metalink support: no (--with-libmetalink)
  129. PSL support: no (libpsl not found)
  130. HTTP2 support: disabled (--with-nghttp2)
  131. Protocols: DICT FILE FTP FTPS GOPHER HTTP HTTPS IMAP IMAPS POP3 POP3S RTSP SMB SMBS SMTP SMTPS TELNET TFTP
  132.  
  133. ################################################################################
  134.  
  135. # 安装jpeg
  136. #wget:http://ftp.gnu.org/gnu/libtool/libtool-2.2.6a.tar.gz
  137. tar -zxf libtool-2.2.6a.tar.gz -C /usr/local/lab
  138. cd /usr/local/lab/libtool-2.2.
  139. ./configure
  140. make && make install
  141.  
  142. 然后进入jpeg-6b的源码目录,然后执行以下步骤,切记!COPY到当前目录注意后面的点(.)
  143. 网上好多都把config.subconfig.guess的路径弄错了,应该是在/usr/share/libtool/config/下,而不是在
  144. /usr/share/libtool/下
  145.  
  146. cd jpeg
  147. cp /usr/share/libtool/config/config.sub .
  148. cp /usr/share/libtool/config/config.guess .
  149.  
  150. mkdir -p /usr/local/libjpeg-6b/bin
  151. mkdir -p /usr/local/libjpeg-6b/lib
  152. mkdir -p /usr/local/libjpeg-6b/man/man1
  153.  
  154. ./configure --prefix=/usr/local/libjpeg-6b --enable-shared --enable-static
  155. make && make install
  156.  
  157. # 安装freetype2.5.4
  158. mkdir -p /usr/local/lab/freetype-2.5./include/freetype2/config
  159. mkdir -p /usr/local/lab/freetype-2.5./include/freetype2/freetype/config
  160. ./configure --prefix=/usr/local/lab/freetype-2.5.
  161. make && make install
  162.  
  163. ***************************************
  164.  
  165. # 编译安装 libmcrypt, mhash, mcrypt 二进制源码包(这种方法只适合php7以下版本,对php7没用)
  166.  
  167. # libmcrypt
  168. tar -zxf libmcrypt-2.5..tar.gz
  169. cd libmcrypt-2.5.
  170. ./configure --prefix=/usr/local/lab/libmcrypt-2.5.8_php7.
  171. make && make install
  172.  
  173. # mhash
  174. tar -zxf mhash-0.9.9.9.tar.gz
  175. cd mhash-0.9.9.9
  176. ./configure --prefix=/usr/local/lab/mhash-0.9.9.9
  177. make && make install
  178.  
  179. # mcrypt
  180. tar -zxf mcrypt-2.6..tar.gz
  181. cd mcrypt-2.6.
  182.  
  183. export LD_LIBRARY_PATH=/usr/local/lab/libmcrypt-2.5.8_php7./lib:/usr/local/lab/mhash-0.9.9.9/lib
  184. export LDFLAGS="-L/usr/local/lab/mhash-0.9.9.9/lib -I/usr/local/lab/mhash-0.9.9.9/include/"
  185. export CFLAGS="-I/usr/local/lab/mhash-0.9.9.9/include/"
  186. ./configure --prefix=/usr/local/lab/mcrypt-2.6. --with-libmcrypt-prefix=/usr/local/lab/libmcrypt-2.5.8_php7.
  187. make && make install
  188.  
  189. ***************************************
  190.  
  191. # php7.2安装mcrypt
  192. tar -zxf mcrypt-1.0..tgz
  193. cd mcrypt-1.0.
  194. # 在mcrypt-1.0.1目录下执行phpize命令,会生成configure命令
  195. [root@web01:/usr/local/src/mcrypt-1.0.]# /usr/local/php-7.2.11_fpm/bin/phpize
  196. Configuring for:
  197. PHP Api Version:
  198. Zend Module Api No:
  199. Zend Extension Api No:
  200.  
  201. [root@web01:/usr/local/src/mcrypt-1.0.]# ./configure --with-php-config=/usr/local/php-7.2.11_fpm/bin/php-config
  202.  
  203. ## Redis扩展
  204. echo "*******************install Redis扩展 start*******************"
  205. cd /usr/local/src && wget http://pecl.php.net/get/redis-4.1.1.tgz
  206. tar -zxvf redis-4.1..tgz
  207. cd redis-4.1./
  208. /usr/local/php/bin/phpize
  209. ./configure --with-php-config=/usr/local/php/bin/php-config
  210. make && make install
  211.  
  212. ## SeasLog扩展
  213. [root@web01:/usr/local/src]# tar -zxf SeasLog-1.8..tgz
  214. [root@web01:/usr/local/src]# cd SeasLog-1.8.
  215. [root@web01:/usr/local/src/SeasLog-1.8.]# /usr/local/php-7.2.11_fpm/bin/phpize
  216. Configuring for:
  217. PHP Api Version:
  218. Zend Module Api No:
  219. Zend Extension Api No:
  220. [root@web01:/usr/local/src/SeasLog-1.8.]# ./configure --with-php-config=/usr/local/php-7.2.11_fpm/bin/php-config
  221. [root@web01:/usr/local/src/SeasLog-1.8.]# make && make install
  222.  
  223. ### memcached扩展
  224. # 编译安装libmemcached-1.0.
  225. tar -zxf libmemcached-1.0..tar.gz
  226. cd libmemcached-1.0.
  227. ./configure --prefix=/usr/local/lab/libmemcached-1.0. --with-memcached
  228.  
  229. # 安装php-memcached扩展
  230. php使用memcache的扩展有两个,一个memcache,一个memcached,前者比较老,推荐使用第二个,我们这里以第二个为例:
  231.  
  232. github上找到适用于php7的分支https://github.com/php-memcached-dev/php-memcached/tree/php7
  233.  
  234. # 解压
  235. unzip php-memcached-php7.zip
  236. cd php-memcached-php7
  237.  
  238. # 执行phpize会生成configure文件
  239. /usr/local/php/bin/phpize
  240. # 执行预编译
  241. ./configure --enable-memcached --with-php-config=/usr/local/php/bin/php-config --with-libmemcached-dir=/usr/local/lab/libmemcached-1.0. --disable-memcached-sasl
  242. make && make install
  243.  
  244. # 安装rar扩展
  245. tar -zxf rar-4.0..tgz
  246. cd rar-4.0.
  247. /usr/local/php/bin/phpize
  248. ./configure --with-php-config=/usr/local/php/bin/php-config
  249. make && make install
  250.  
  251. ####安装zmq扩展
  252.  
  253. .到zeromq官网查看版本信息:http://zeromq.org/intro:get-the-software
  254.  
  255. .Linux服务器跟目录下依次执行以下命令:
  256.  
  257. wget https://github.com/zeromq/libzmq/releases/download/v4.2.2/zeromq-4.2.5.tar.gz
  258.  
  259. tar zxvf zeromq-4.2..tar.gz
  260. cd zeromq-4.2.
  261. ./configure
  262. make
  263. make install
  264.  
  265. .切回根目录,执行以下步骤:
  266.  
  267. 下载https://codeload.github.com/mkoppanen/php-zmq/zip/master/php-zmq-master.zip
  268. unzip php-zmq-master.zip
  269. cd php-zmq-master
  270. /usr/local/php/bin/phpize
  271. ./configure --with-php-config=/usr/local/php/bin/php-config
  272. make
  273. make install
  274.  
  275. # 编辑php配置文件,在最后面加入
  276. # vim /usr/local/php/etc/php.ini
  277.  
  278. extension=zmq.so
  279.  
  280. # 编辑php.ini文件添加扩展,并重启php-fpm
  281.  
  282. extension=rar.so
  283. extension=memcache.so
  284. extension=memcached.so
  285. extension=redis.so
  286. extension=seaslog.so
  287. extension=pcntl.so
  288. extension=rar.so
  289. extension=mcrypt.so
  290.  
  291. ###编译安装bcmath
  292. .进入PHP源码包目录下的ext/bcmath目录
  293. .执行phpize命令,phpize命令在PHP安装目录的bin目录下,如 /usr/local/php-7.2./bin/phpize
  294. .执行./configure --with-php-config=/usr/local/php-7.2.11_fpm/bin/php-config
  295. make && make install
  296.  
  297. ####安装 amqp扩展
  298. # 安装前要先安装rabbitmq-c
  299. wget -c https://github.com/alanxz/rabbitmq-c/releases/download/v0.8.0/rabbitmq-c-0.8.0.tar.gz
  300. tar zxf rabbitmq-c-0.8..tar.gz
  301. cd rabbitmq-c-0.8.
  302. ./configure --prefix=/usr/local/rabbitmq-c-0.8.
  303. make && make install
  304.  
  305. # 安装amqp
  306. tar zxf amqp-1.9..tgz
  307. cd amqp-1.9.
  308. /usr/local/php/bin/phpize
  309. ./configure --with-php-config=/usr/local/php/bin/php-config --with-amqp --with-librabbitmq-dir=/usr/local/rabbitmq-c-0.8.
  310. make && make install
  311.  
  312. # 安装amqp的时候报错:
  313. cc -I. -I/usr/local/src/amqp-1.9. -DPHP_ATOM_INC -I/usr/local/src/amqp-1.9./include -I/usr/local/src/amqp-1.9./main -I/usr/local/src/amqp-1.9. -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.//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
  314. /usr/local/src/amqp-1.9./amqp_connection_resource.c::: error: amqp_ssl_socket.h: No such file or directory
  315. /usr/local/src/amqp-1.9./amqp_connection_resource.c: In function connection_resource_constructor’:
  316. /usr/local/src/amqp-1.9./amqp_connection_resource.c:: warning: assignment makes pointer from integer without a cast
  317. make: *** [amqp_connection_resource.lo] Error
  318.  
  319. 解决:
  320.  
  321. 参考:https://github.com/alanxz/rabbitmq-c/issues/463
  322. [root@sz_xx_cmsby01_11_99:/usr/local/src/amqp-1.9.]# find /usr/local -name amqp_ssl_socket.h
  323. /usr/local/src/rabbitmq-c-0.8./librabbitmq/amqp_ssl_socket.h
  324. [root@sz_xx_cmsby01_11_99:/usr/local/src/amqp-1.9.]# cp /usr/local/src/rabbitmq-c-0.8./librabbitmq/amqp_ssl_socket.h ./
  325.  
  326. # 重新make && make install 即可

####### 安装imap扩展
# 安装imap依赖

  1.  

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

  1.  

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

  1.  

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

  1. # 安装memcache扩展
  2. unzip pecl-memcache-NON_BLOCKING_IO_php7.zip
  3. cd pecl-memcache-NON_BLOCKING_IO_php7
  4. /usr/local/php/bin/phpize
  5. ./configure --with-php-config=/usr/local/php/bin/php-config
  6. make
  7. make install
  8.  
  9. ### 安装php7..11版本中自带的扩展intl
  10.  
  11. a.PHP intl 是国际化扩展,是ICU 库的一个包装器。所以在安装PHP intl扩展前要先安装ICU库,安装ICU库的具体步骤:
  12.  
  13. mkdir /usr/local/lab/icu
  14. cd /usr/local/lab/icu
  15. wget http://download.icu-project.org/files/icu4c/52.1/icu4c-52_1-src.tgz
  16. tar xf icu4c-52_1-src.tgz
  17. cd icu/source
  18. ./configure --prefix=/usr/local/lab/icu
  19. make && make install
  20. 安装完毕:
  21. 注:icu版本你也可以去官网下载:http://site.icu-project.org/download  。--prefix=/usr/local/icu为icu的安装路径,也可以通过find /  -name  icu查找。
  22.  
  23. b.安装扩展intl.so
  24.  
  25. .进入php7源码:cd /usr/local/src/php-7.2./ext/intl
  26.  
  27. .运行:phpize ,找不到命令时,将路径补全:/usr/local/php/bin/phpize(是php的安装路径),出现如下:
  28.  
  29. [root@sz_xx_cmsby01_11_99:/usr/local/src/php-7.2./ext/intl]# /usr/local/php/bin/phpize
  30. Configuring for:
  31. PHP Api Version:
  32. Zend Module Api No:
  33. Zend Extension Api No:
  34.  
  35. c.运行配置
  36.  
  37. ./configure --enable-intl --with-icu-dir=/usr/local/lab/icu --with-php-config=/usr/local/php/bin/php-config
  38. make && make install
  39.  
  40. 注:前面路径为icu的安装路径,后面路径为php的安装路径
  41.  
  42. 二、编译安装php7.2.11
  43.  
  44. tar -zxf php-7.2..tar.gz
  45. cd php-7.2.
  46. ./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. --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./ --with-freetype-dir=/usr/local/lab/freetype-2.5. --with-gd=/usr/local/lab/libgd-2.1. --with-gettext --enable-mbstring --with-ldap=/usr/local/openldap-2.4. --with-mcrypt=/usr/local/lab/libmcrypt-2.5.8_php7. --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. --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
  47.  
  48. ....
  49.  
  50. creating libtool
  51. appending configuration tag "CXX" to libtool
  52.  
  53. Generating files
  54. configure: creating ./config.status
  55. creating main/internal_functions.c
  56. creating main/internal_functions_cli.c
  57. +--------------------------------------------------------------------+
  58. | License: |
  59. | This software is subject to the PHP License, available in this |
  60. | distribution in the file LICENSE. By continuing this installation |
  61. | process, you are bound by the terms of this license agreement. |
  62. | If you do not agree with the terms of this license, you must abort |
  63. | the installation process at this point. |
  64. +--------------------------------------------------------------------+
  65.  
  66. Thank you for using PHP.
  67.  
  68. config.status: creating php7.spec
  69. config.status: creating main/build-defs.h
  70. config.status: creating scripts/phpize
  71. config.status: creating scripts/man1/phpize.
  72. config.status: creating scripts/php-config
  73. config.status: creating scripts/man1/php-config.
  74. config.status: creating sapi/cli/php.
  75. config.status: creating sapi/fpm/php-fpm.conf
  76. config.status: creating sapi/fpm/www.conf
  77. config.status: creating sapi/fpm/init.d.php-fpm
  78. config.status: creating sapi/fpm/php-fpm.service
  79. config.status: creating sapi/fpm/php-fpm.
  80. config.status: creating sapi/fpm/status.html
  81. config.status: creating sapi/phpdbg/phpdbg.
  82. config.status: creating sapi/cgi/php-cgi.
  83. config.status: creating ext/phar/phar.
  84. config.status: creating ext/phar/phar.phar.
  85. config.status: creating main/php_config.h
  86. config.status: executing default commands
  87. configure: WARNING: unrecognized options: --with-mcrypt, --with-mysql
  88.  
  89. # make && make install
  90.  
  91. 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
  92. /usr/bin/ld: warning: libssl.so., needed by /usr/local/openldap-2.4./lib/libldap.so, may conflict with libssl.so.1.1
  93. /usr/bin/ld: warning: libssl.so., needed by /usr/local/openldap-2.4./lib/libldap.so, may conflict with libssl.so.1.1
  94. /usr/bin/ld: warning: libssl.so., needed by /usr/local/openldap-2.4./lib/libldap.so, may conflict with libssl.so.1.1
  95. /usr/bin/ld: warning: libssl.so., needed by /usr/local/openldap-2.4./lib/libldap.so, may conflict with libssl.so.1.1
  96. /usr/bin/ld: warning: libcrypto.so., needed by /usr/local/openldap-2.4./lib/libldap.so, may conflict with libcrypto.so.1.1
  97. /usr/bin/ld: warning: libcrypto.so., needed by /usr/local/openldap-2.4./lib/libldap.so, may conflict with libcrypto.so.1.1
  98. /usr/bin/ld: warning: libcrypto.so., needed by /usr/local/openldap-2.4./lib/libldap.so, may conflict with libcrypto.so.1.1
  99. /usr/bin/ld: warning: libcrypto.so., needed by /usr/local/openldap-2.4./lib/libldap.so, may conflict with libcrypto.so.1.1
  100. /usr/bin/ld: warning: libcrypto.so., needed by /usr/local/openldap-2.4./lib/libldap.so, may conflict with libcrypto.so.1.1
  101. /usr/bin/ld: warning: libcrypto.so., needed by /usr/local/openldap-2.4./lib/libldap.so, may conflict with libcrypto.so.1.1
  102. /usr/bin/ld: warning: libcrypto.so., needed by /usr/local/openldap-2.4./lib/libldap.so, may conflict with libcrypto.so.1.1
  103. Generating phar.php
  104. Generating phar.phar
  105. PEAR package PHP_Archive not installed: generated phar will require PHP's phar extension be enabled.
  106. directorygraphiterator.inc
  107. invertedregexiterator.inc
  108. pharcommand.inc
  109. directorytreeiterator.inc
  110. clicommand.inc
  111. phar.inc
  112.  
  113. Build complete.
  114. Don't forget to run 'make test'.
  115.  
  116. Installing shared extensions: /usr/local/php-7.2.11_fpm/lib/php/extensions/no-debug-non-zts-/
  117. Installing PHP CLI binary: /usr/local/php-7.2.11_fpm/bin/
  118. Installing PHP CLI man page: /usr/local/php-7.2.11_fpm/php/man/man1/
  119. Installing PHP FPM binary: /usr/local/php-7.2.11_fpm/sbin/
  120. Installing PHP FPM defconfig: /usr/local/php-7.2.11_fpm/etc/
  121. Installing PHP FPM man page: /usr/local/php-7.2.11_fpm/php/man/man8/
  122. Installing PHP FPM status page: /usr/local/php-7.2.11_fpm/php/php/fpm/
  123. Installing phpdbg binary: /usr/local/php-7.2.11_fpm/bin/
  124. Installing phpdbg man page: /usr/local/php-7.2.11_fpm/php/man/man1/
  125. Installing PHP CGI binary: /usr/local/php-7.2.11_fpm/bin/
  126. Installing PHP CGI man page: /usr/local/php-7.2.11_fpm/php/man/man1/
  127. Installing build environment: /usr/local/php-7.2.11_fpm/lib/php/build/
  128. Installing header files: /usr/local/php-7.2.11_fpm/include/php/
  129. Installing helper programs: /usr/local/php-7.2.11_fpm/bin/
  130. program: phpize
  131. program: php-config
  132. Installing man pages: /usr/local/php-7.2.11_fpm/php/man/man1/
  133. page: phpize.
  134. page: php-config.
  135. Installing PEAR environment: /usr/local/php-7.2.11_fpm/lib/php/
  136. [PEAR] Archive_Tar - installed: 1.4.
  137. [PEAR] Console_Getopt - installed: 1.4.
  138. [PEAR] Structures_Graph- installed: 1.1.
  139. [PEAR] XML_Util - installed: 1.4.
  140. [PEAR] PEAR - installed: 1.10.
  141. Wrote PEAR system config file at: /usr/local/php-7.2.11_fpm/etc/pear.conf
  142. You may want to add: /usr/local/php-7.2.11_fpm/lib/php to your php.ini include_path
  143. /usr/local/src/php-7.2./build/shtool install -c ext/phar/phar.phar /usr/local/php-7.2.11_fpm/bin
  144. ln -s -f phar.phar /usr/local/php-7.2.11_fpm/bin/phar
  145. Installing PDO headers: /usr/local/php-7.2.11_fpm/include/php/ext/pdo/
  146.  
  147. # 20181211重新编译带https的curl插件
  148. tar -zxf php-7.2..tar.gz
  149. cd php-7.2.
  150. ./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. --with-bz2 --enable-calendar --with-curl=/usr/local/lab/curl-7.36. --enable-dba --enable-exif --enable-ftp --with-jpeg-dir=/usr/local/lab/jpeg-9b --with-png-dir=/usr/local/lab/libpng-1.6./ --with-freetype-dir=/usr/local/lab/freetype-2.5. --with-gd=/usr/local/lab/libgd-2.1. --with-gettext --enable-mbstring --with-ldap=/usr/local/openldap-2.4. --with-mcrypt=/usr/local/lab/libmcrypt-2.5.8_php7. --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. --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
  151.  
  152. .编译安装完php后,要测试一个soap的支付接口,证明apiservice是可以使用的
  153.  
  154. 测试soap的脚本
  155.  
  156. <?php
  157. $buy_url = 'https://api.avangate.com/order/2.0/soap/?wsdl';
  158.  
  159. //$buy_url = 'http://www.webxml.com.cn/WebServices/StockInfoWS.asmx?wsdl';
  160. $options = array(
  161. 'cache_wsdl'=>WSDL_CACHE_NONE,
  162. );
  163. try {
  164. $client = new SoapClient($buy_url, $options);
  165. } catch (\SoapFault $e) {
  166. $client = $e->getMessage();
  167. }
  168. var_dump($client);
  169.  
  170. # 运行后报错:
  171. string() "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" "
  172.  
  173. .在网上找了很多方法,主流的方法都测试过了发现不行
  174. 比如关闭ssl验证等
  175.  
  176. 于是想快速yum安装php7..11看是否是环境的问题,下面是安装方法,安装好以后发现问题依旧
  177.  
  178. a.安装php最新rpm包的yum
  179. rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
  180. rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
  181.  
  182. b.通过yum方式安装php7.2.11
  183.  
  184. 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
  185.  
  186. .看到一个引入nusoap的方法
  187.  
  188. nusoap是一个封装了saop常用方法的类库,直接引入就可以使用了
  189.  
  190. # 引入nusoap这个库文件就可以搞定wsdl报错,如下
  191. [root@web01:/data/www/vhosts/film.wondershare.com/httpdocs/api/public]# cat printsoa.php
  192. <?php
  193. require_once("lib/nusoap.php");
  194. $buy_url = 'https://api.avangate.com/order/2.0/soap/?wsdl';
  195.  
  196. $client = new nusoap_client($buy_url, "wsdl");
  197. // 避免乱码
  198. $client->soap_defencoding = 'UTF-8';
  199. $client->decode_utf8 = false;
  200. $client->xml_encoding = 'UTF-8';
  201.  
  202. $options = array(
  203. 'cache_wsdl'=>WSDL_CACHE_NONE,
  204. );
  205.  
  206. //$client->call('function_name', $options);
  207. var_dump($client);
  208. ?>
  209.  
  210. https://sourceforge.net/projects/nusoap/files/nusoap/
  211.  
  212. 让开发的同事研究一下使用方法应该就可以了
  213.  
  214. ###################
  215.  
  216. # 测试openssl-1.0.2p版本编译安装Php7.2.11(推荐)
  217.  
  218. tar -zxf php-7.2..tar.gz
  219. cd php-7.2.
  220. ./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. --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./ --with-freetype-dir=/usr/local/lab/freetype-2.5. --with-gd=/usr/local/lab/libgd-2.1. --with-gettext --enable-mbstring --with-ldap=/usr/local/openldap-2.4. --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. --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
  221.  
  222. # 使用系统默认的openssl编译安装php7.2.11
  223. ./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. --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./ --with-freetype-dir=/usr/local/lab/freetype-2.5. --with-gd=/usr/local/lab/libgd-2.1. --with-gettext --enable-mbstring --with-ldap=/usr/local/openldap-2.4. --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. --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

centos7.6编译安装php7.2.11及redis/memcached/rabbitmq/openssl/curl等常见扩展的更多相关文章

  1. centos7下编译安装php-7.0.15(PHP-FPM)

    centos7下编译安装php-7.0.15(PHP-FPM) 一.下载php7源码包 http://php.net/downloads.php 如:php-7.0.15.tar.gz 二.安装所需依 ...

  2. Linux Centos7.2 编译安装PHP7.0.2

    操作环境: 1.系统:Centos7.2 2.服务:Nginx 1.下载PHP7.0.2的安装包解压,编译,安装: $ cd /usr/src/ $ wget http://cn2.php.net/d ...

  3. centos7 编译安装 php7.3.11

    1.安装依赖 yum install -y libxml2 *openssl* libcurl* libjpeg* libpng* freetype* libmcrypt* gcc gcc-c++ 2 ...

  4. Centos7.2 编译安装PHP7

    PHP7,编译安装: 环境:centos7.2    (注意:因为我用的nginx, 此配置参数没有考虑到apache,所以不合适需要用apache的朋友照搬过去运行,但是可以参考.)   直接下载P ...

  5. centos7.6编译安装php7.3

    刚开始搞环境装过集成,发现不好用,后来自己编译安装一些扩展啊设置的都很容易找到. 以前装过5.6.7.0发现不一样,最近出了7.3是php5速度的三倍,那有必要升级一下列. 由于之前安装过老版本,依赖 ...

  6. centos7下编译安装php7.3

    一.下载php7.3的源码 https://www.php.net/downloads.php 下载php-7.3.4.tar.gz 二.安装gcc,gcc-c++,kernel-devel yum ...

  7. CentOS7.2编译安装PHP7.2.3之史上最详细步骤。

    首先,我们的CentOS版本信息如下: 开始我们的编译. 第一步: 将php安装包安装到/usr/src目录下. cd /usr/src && wget http://cn2.php. ...

  8. CentOS7手动编译安装内核4.11.7

    1. 进入/usr/src/目录 cd /usr/src 2. 下载内核源码,网址:https://www.kernel.org wget https://cdn.kernel.org/pub/lin ...

  9. centos7.6环境编译安装php-7.2.24修复最新 CVE-2019-11043 漏洞

    先编译安装php-7.2.24,然后编译安装扩展 主版本地址地址:https://www.php.net/distributions/php-7.2.24.tar.gz # 编译 php-7.2.24 ...

随机推荐

  1. Jenkins下载历史Build版本的归档文件

    /root/.jenkins/jobs/zgg-crm-pre/builds//com.zgg$crm/archive/com.zgg/crm/0.0.1/crm-0.0.1.war https:// ...

  2. [模板] 二分图博弈 && BZOJ2463:[中山市选2009]谁能赢呢?

    二分图博弈 from BZOJ 1443 游戏(二分图博弈) - free-loop - 博客园 定义 1.博弈者人数为两人,双方轮流进行决策. 2.博弈状态(对应点)可分为两类(状态空间可分为两个集 ...

  3. P1137 旅行计划

    /*拓扑排序去寻找点的拓扑序 便于DP,那么怎么去找 首先邻接表存边,然后dfs搜寻每一个点 最后进行拓扑排序,找到拓扑序*/ #include<bits/stdc++.h> ; ; us ...

  4. P2613 有理数取余

    原题链接 https://www.luogu.org/problemnew/show/P2613 在这里虽然是讲洛谷的题解,但用到的数论知识,归并到数论里也不为过! 进入正题: 首先看到题面:给出一个 ...

  5. ☆ [WC2006] 水管局长 「LCT动态维护最小生成树」

    题目类型:\(LCT\)动态维护最小生成树 传送门:>Here< 题意:给出一张简单无向图,要求找到两点间的一条路径,使其最长边最小.同时有删边操作 解题思路 两点间路径的最长边最小,也就 ...

  6. MT【318】分式不等式双代换

    已知$a,b>0$且$\dfrac{1}{a}+\dfrac{1}{b}=\dfrac{2}{3}$,求$\dfrac{1}{a-1}+\dfrac{4}{b-1}$的最小值. 解:令$m=\d ...

  7. tomcat在windows及linux环境下安装

    下载tomcat 下载地址: https://tomcat.apache.org/download-90.cgi 7,8,9的版本都可以下,这里下载最新版本 注意:Binary是编译好的,可以直接使用 ...

  8. Java基础 -- 访问控制权限

    一  包:库单元 假设我们存在两个类名相同的类,如果没有一定的措施对其进行区分,就会无法区别到底使用的是哪一个类.因此java引入了包来进行名字空间管理. 包(类库)包含有一组类,这些类在单一的名字空 ...

  9. 什么是javabean及其用法(转)

    因工作需要 需要学习jsp方面的知识 这篇博客文章写得比较全面 我记录下: 一.什么是JavaBean JavaBean是一个遵循特定写法的Java类,它通常具有如下特点: 这个Java类必须具有一个 ...

  10. spring boot本地调试服务器部署项目

    项目本地测试然后发布到服务器上,各种BUG层出不穷.那么下面配置下,然后在本地调试部署在服务器上的程序吧 一.首先idea打开你的项目,服务器上传打包的程序.然后如下命令启动(linux),绿色参数为 ...