您当前的位置:首页 > 电脑百科 > 程序开发 > 语言 > php

centos7系统源码编译安装PHP7.3.5版本

时间:2019-09-09 11:53:21  来源:  作者:
centos7系统源码编译安装PHP7.3.5版本

 

新增系统用户组和用户:

[root@localhost ~]# groupadd webg

[root@localhost ~]# useradd -g webg webu

下载 php7.3.5

[root@localhost ~]# mkdir devdir

[root@localhost ~]# cd devdir/

[root@localhost devdir]# wget https://www.php.net/distributions/php-7.3.5.tar.gz

-bash: wget: 未找到命令

[root@localhost devdir]# rpm -qa|grep wget

[root@localhost devdir]# yum -y install wget

[root@localhost devdir]# rpm -qa|grep wget

wget-1.14-18.el7.x86_64

下载PHP7 解压 编译

wget -c https://downloads.php.net/~cmb/php-7.3.4.tar.gz

centos7系统源码编译安装PHP7.3.5版本

 


centos7系统源码编译安装PHP7.3.5版本

 

编译参数解释

--with-fpm-user=webu --with-fpm-group=webg 添加PHP运行用户和用户组

centos7系统源码编译安装PHP7.3.5版本

 

./configure --prefix=/usr/local/php --with-fpm-user=webu --with-fpm-group=webg --with-freetype-dir --with-gd --with-gettext --with-iconv-dir --with-kerberos --with-libdir=lib64 --with-libxml-dir --with-MySQLi --with-openssl --with-pcre-regex --with-pdo-mysql --with-pdo-sqlite --with-pear --with-png-dir --with-jpeg-dir --with-xmlrpc --with-xsl --with-bz2 --with-mhash --enable-fpm --enable-bcmath --enable-libxml --enable-inline-optimization --enable-mbregex --enable-mbstring --enable-opcache --enable-pcntl --enable-shmop --enable-soap --enable-sockets --enable-sysvsem --enable-sysvshm --enable-xml --enable-fpm

配置信息出错:

configure: error: in `/root/devdir/php-7.3.4':
configure: error: no acceptable C compiler found in $PATH
See `config.log' for more details
[root@localhost php-7.3.4]# vim config.log 

下载gcc软件编译器 yum install -y gcc

configure: error: libxml2 not found. Please check your libxml2 installation.

checking for pkg-config... /usr/bin/pkg-config
configure: error: libxml2 not found. Please check your libxml2 installation.
[root@localhost php-7.3.4]# rpm -qa|grep libxml2
libxml2-2.9.1-6.el7_2.3.x86_64
[root@localhost php-7.3.4]# 
[root@localhost php-7.3.4]# yum install -y libxml2-devel
checking for pkg-config... /usr/bin/pkg-config
configure: error: Cannot find OpenSSL's <evp.h>
[root@localhost php-7.3.4]# rpm -qa|grep openssl
openssl-1.0.2k-16.el7.x86_64
openssl-libs-1.0.2k-16.el7.x86_64
[root@localhost php-7.3.4]# yum install -y openssl-devel
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.nwsuaf.edu.cn
 * extras: mirror.lzu.edu.cn
checking for BZip2 in default path... not found
configure: error: Please reinstall the BZip2 distribution
[root@localhost php-7.3.4]# yum install -y bzip2-devel
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.cn99.com
 * extras: mirrors.163.com
checking for cURL 7.15.5 or greater... configure: error: cURL version 7.15.5 or later is required to compile php with cURL support
[root@localhost php-7.3.4]# rpm -qa|grep curl
curl-7.29.0-51.el7.x86_64
libcurl-7.29.0-51.el7.x86_64
Python-pycurl-7.19.0-19.el7.x86_64
[root@localhost php-7.3.4]# yum install -y curl-devel
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.nwsuaf.edu.cn
 * extras: mirrors.cn99.com
checking whether to enable JIS-mApped Japanese font support in GD... no
If configure fails try --with-webp-dir=<DIR>
configure: error: jpeglib.h not found.
[root@localhost php-7.3.4]# yum install -y libjpeg-devel
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.nwsuaf.edu.cn
configure: error: png.h not found.
[root@localhost php-7.3.4]# yum install -y libpng-devel
已加载插件:fastestmirror
If configure fails try --with-xpm-dir=<DIR>
configure: error: freetype-config not found.
[root@localhost php-7.3.4]# yum install -y freetype-devel
已加载插件:fastestmirror
configure: error: xslt-config not found. Please reinstall the libxslt >= 1.1.0 distribution
[root@localhost php-7.3.4]# yum install -y libxslt-devel
已加载插件:fastestmirror
configure: error: Please reinstall the libzip distribution
[root@localhost php-7.3.4]# rpm -qa|grep libzip
[root@localhost php-7.3.4]# yum install -y libzip
已加载插件:fastestmirror
[root@localhost php-7.3.4]# rpm -qa|grep libzip
libzip-0.10.1-8.el7.x86_64
[root@localhost php-7.3.4]# yum install -y libzip-devel
已加载插件:fastestmirror
checking for libzip... configure: error: system libzip must be upgraded to version >= 0.11
[root@localhost php-7.3.4]# 

下载libzip-1.5.2.tar.gz

https://libzip.org/download/libzip-1.5.2.tar.gz

[root@localhost devdir]# pwd
/root/devdir
[root@localhost devdir]# wget -c https://libzip.org/download/libzip-1.5.2.tar.gz--2019-05-09 15:02:31-- https://libzip.org/download/libzip-1.5.2.tar.gz
正在解析主机 libzip.org (libzip.org)... 5.2.73.210, 2a04:52c0:101:2e6::de6c
正在连接 libzip.org (libzip.org)|5.2.73.210|:443... 已连接。
已发出 HTTP 请求,正在等待回应... 200 OK
长度:1203524 (1.1M) [application/x-gzip]
正在保存至: “libzip-1.5.2.tar.gz”
100%[======================================>] 1,203,524 44.8KB/s 用时 36s 
2019-05-09 15:03:14 (32.8 KB/s) - 已保存 “libzip-1.5.2.tar.gz” [1203524/1203524])
[root@localhost devdir]# tar zxvf libzip-1.5.2.tar.gz 
libzip-1.5.2/
[root@localhost libzip-1.5.2]# ls
API-CHANGES.md CMakeLists.txt INSTALL.md man src
appveyor.yml cmake-zipconf.h.in lib NEWS.md THANKS
AUTHORS examples libzip.pc.in README.md TODO.md
cmake-config.h.in FindNettle.cmake LICENSE regress
[root@localhost libzip-1.5.2]# mkdir build && cd build
[root@localhost build]# cmake -DCMAKE_INSTALL_PREFIX=/usr/local/libzip ..
-bash: cmake: 未找到命令
[root@localhost build]# yum install -y cmake 【版本太低所以安装cmake最新版】
[root@localhost build]# rm -f CMakeCache.txt 
[root@localhost build]# cmake -DCMAKE_INSTALL_PREFIX=/usr/local/libzip ..
CMake Error at CMakeLists.txt:4 (CMAKE_MINIMUM_REQUIRED):
 CMake 3.0.2 or higher is required. You are running version 2.8.12.2
-- Configuring incomplete, errors occurred!
[root@localhost build]# yum remove -y cmake
已加载插件:fastestmirror
[root@localhost devdir]# wget -c https://github.com/Kitware/CMake/releases/download/v3.14.3/cmake-3.14.3.tar.gz
[root@localhost devdir]# tar -zxvf cmake-3.14.3.tar.gz
[root@localhost devdir]# cd cmake-3.14.3
[root@localhost cmake-3.14.3]# ./configure 
---------------------------------------------
CMake 3.14.3, Copyright 2000-2019 Kitware, Inc. and Contributors
C compiler on this system is: cc 
---------------------------------------------
Error when bootstrapping CMake:
Cannot find a C++ compiler that supports both C++11 and the specified C++ flags.
Please specify one using environment variable CXX.
[root@localhost cmake-3.14.3]# yum install -y gcc-c++ 【安装gcc-c++编译环境】
[root@localhost cmake-3.14.3]# ./bootstrap 
[root@localhost cmake-3.14.3]# gmake &&gmake install
[root@localhost cmake-3.14.3]# which cmake
/usr/local/bin/cmake
[root@localhost cmake-3.14.3]# cmake --version
-bash: /usr/bin/cmake: 没有那个文件或目录
[root@localhost cmake-3.14.3]# cmake
-bash: /usr/bin/cmake: 没有那个文件或目录
[root@localhost cmake-3.14.3]# vim /etc/profile
文件末尾 PATH="$PATH=/usr/local/bin" export PATH
[root@localhost cmake-3.14.3]# source /etc/profile
[root@localhost cmake-3.14.3]# cmake --version
cmake version 3.14.3
CMake suite maintained and supported by Kitware (kitware.com/cmake).
[root@localhost cmake-3.14.3]# 

解决libzip 和cmake版本问题

重新配置PHP7编译环境参数

checking for libzip... not found
configure: error: Please reinstall the libzip distribution
[root@localhost php-7.3.4]# yum -y install libzip-devel
checking for pkg-config... (cached) /usr/bin/pkg-config
checking for libzip... configure: error: system libzip must be upgraded to version >= 0.11
[root@localhost php-7.3.4]# which libzip
/usr/bin/which: no libzip in (/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/usr/local/bin:/root/bin)
[root@localhost php-7.3.4]# ll /usr/local/lib
lib/ lib64/ libexec/ libzip/ 
[root@localhost php-7.3.4]# ll /usr/local/libzip/
bin/ include/ lib64/ share/ 
[root@localhost php-7.3.4]# ll /usr/local/libzip/bin/zip
zipcmp zipmerge ziptool 
[root@localhost php-7.3.4]# ll /usr/local/libzip/bin
总用量 80
-rwxr-xr-x. 1 root root 24392 5月 9 16:04 zipcmp
-rwxr-xr-x. 1 root root 18880 5月 9 16:04 zipmerge
-rwxr-xr-x. 1 root root 34928 5月 9 16:04 ziptool
[root@localhost php-7.3.4]# vim /etc/profile
unset i
PATH="$PATH:/usr/local/bin:/usr/local/libzip/bin"
export PATH
[root@localhost php-7.3.4]# source /etc/profile
[root@localhost php-7.3.4]# 

libzip-1.5.2 无法安装,已经取消了。

/root/devdir/libzip-1.5.2/build
[root@localhost build]# cd ../../
[root@localhost devdir]# wget -c https://nih.at/libzip/libzip-1.2.0.tar.gz
[root@localhost devdir]# tar -zxvf libzip-1.2.0.tar.gz 
[root@localhost devdir]# cd libzip-1.2.0
[root@localhost libzip-1.2.0]# ls
aclocal.m4 config.sub libzip-uninstalled.pc.in README.md
API-CHANGES configure LICENSE regress
AUTHORS configure.ac ltmain.sh src
cmake-config.h.in depcomp m4 test-driver
CMakeLists.txt examples Makefile.am THANKS
cmake-zipconf.h.in INSTALL Makefile.in TODO.md
compile install-sh man xcode
config.guess lib missing
config.h.in libzip.pc.in NEWS.md
[root@localhost libzip-1.2.0]# ./configure 
[root@localhost libzip-1.2.0]# make -j4 &&make install
【最终解决方案】
cp ../libzip-1.5.2/build/lib/libzip.so /lib64/

提示off_t类型没有定义 undefind,解决方法:

[root@localhost ~]# cd devdir/php-7.3.4
[root@localhost php-7.3.4]# vim /etc/ld.so.conf
ld.so.conf ld.so.conf.d/ 
[root@localhost php-7.3.4]# vim /etc/ld.so.conf
[root@localhost php-7.3.4]# vim /usr/lib64/
Display all 588 possibilities? (y or n)
[root@localhost php-7.3.4]# vim /usr/lib64/l
Display all 538 possibilities? (y or n)
[root@localhost php-7.3.4]# vim /usr/lib64/lib
Display all 535 possibilities? (y or n)
[root@localhost php-7.3.4]# vim /etc/ld.so.conf
include ld.so.conf.d/*.conf
/usr/local/lib64
/usr/local/lib
/usr/lib
/usr/lib64
[root@localhost php-7.3.4]# ldconfig -v
ldconfig: 多次给出路径“/lib”
centos7系统源码编译安装PHP7.3.5版本

 

编译安装

centos7系统源码编译安装PHP7.3.5版本

 

In file included from /root/devdir/php-7.3.4/ext/zip/php_zip.h:31:0,
 from /root/devdir/php-7.3.4/ext/zip/php_zip.c:36:
/usr/local/include/zip.h:59:21: 致命错误:zipconf.h:没有那个文件或目录
 #include <zipconf.h>
 ^
编译中断。
make: *** [ext/zip/php_zip.lo] 错误 1
解决方案:
cp /usr/local/lib/libzip/include/zipconf.h /usr/local/include/zipconf.h
[root@localhost php-7.3.4]# cp /usr/local/lib/libzip/include/zipconf.h /usr/local/include/

测试PHP是否安装成功

Installing PEAR environment: /usr/local/php/lib/php/
[PEAR] Archive_Tar - installed: 1.4.5
[PEAR] Console_Getopt - installed: 1.4.2
[PEAR] Structures_Graph- installed: 1.1.1
[PEAR] XML_Util - installed: 1.4.3
[PEAR] PEAR - installed: 1.10.9
Wrote PEAR system config file at: /usr/local/php/etc/pear.conf
You may want to add: /usr/local/php/lib/php to your php.ini include_path
/root/devdir/php-7.3.4/build/shtool install -c ext/phar/phar.phar /usr/local/php/bin
ln -s -f phar.phar /usr/local/php/bin/phar
Installing PDO headers: /usr/local/php/include/php/ext/pdo/
[root@localhost php-7.3.4]# php -v
-bash: php: 未找到命令
[root@localhost php-7.3.4]# ll /usr/local/php/
bin/ etc/ include/ lib/ php/ sbin/ var/ 
[root@localhost php-7.3.4]# ll /usr/local/php/bin/p
pear pecl phar.phar php-cgi phpdbg 
peardev phar php php-config phpize 
[root@localhost php-7.3.4]# vim /etc/profile
[root@localhost php-7.3.4]# source /etc/profile
[root@localhost php-7.3.4]# php -v
PHP 7.3.4 (cli) (built: May 9 2019 17:39:42) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.4, Copyright (c) 1998-2018 Zend Technologies
[root@localhost php-7.3.4]# 

转载自:https://my.oschina.net/u/4127346/blog/3047778



Tags:centos PHP   点击:()  评论:()
声明:本站部分内容及图片来自互联网,转载是出于传递更多信息之目的,内容观点仅代表作者本人,如有任何标注错误或版权侵犯请与我们联系(Email:2595517585@qq.com),我们将及时更正、删除,谢谢。
▌相关推荐
新增系统用户组和用户:[root@localhost ~]# groupadd webg[root@localhost ~]# useradd -g webg webu下载 PHP7.3.5[root@localhost ~]# mkdir devdir[root@localhost ~]# c...【详细内容】
2019-09-09  Tags: centos PHP  点击:(268)  评论:(0)  加入收藏
▌简易百科推荐
序言:前段时间织梦因为版权的问题在网上闹得沸沸扬扬,也提醒了众多开发者选择cms上应该谨慎使用,今天给大家展示一款自己搭建的内容管理系统,不用担心版权的问题,而且非常容易维...【详细内容】
2021-11-30  小程序软件开发    Tags:管理系统   点击:(34)  评论:(0)  加入收藏
准备安装包(PHP: Hypertext Preprocessor)下载安装包以及组件wget https://www.php.net/distributions/php-8.0.0.tar.bz2wget https://github.com/phpredis/phpredis/archive...【详细内容】
2021-11-09  mimic96    Tags:PHP   点击:(40)  评论:(0)  加入收藏
golang context 很好用,就使用php实现了github地址 : https://github.com/qq1060656096/php-go-context context使用闭坑指南1. 将一个Context参数作为第一个参数传递给传入和...【详细内容】
2021-11-05  1060656096    Tags:PHP   点击:(41)  评论:(0)  加入收藏
一段数组为例:$list = array:4 [ 0 => array:7 [ "id" => 56 "mer_id" => 7 "order_id" => "wx163265961408769974" "is_postage" => 0 "store_name" => "奇...【详细内容】
2021-09-29  七七小影视    Tags:PHP   点击:(65)  评论:(0)  加入收藏
利用JS的CryptoJS 3.x和PHP的openssl_encrypt,openssl_decrypt实现AES对称加密解密,由于需要两种语言对同一字符串的操作,而CryptoJS 的默认加密方式为“aes-256-cbc”,PHP端也...【详细内容】
2021-09-16  李老师tome    Tags:对称加密   点击:(79)  评论:(0)  加入收藏
1、checkdate()验证格利高里日期即:日期是否存在。checkdate(month,day,year);month必需。一个从 1 到 12 的数字,规定月。day必需。一个从 1 到 31 的数字,规定日。year必需。...【详细内容】
2021-08-31  七七小影视    Tags:时间函数   点击:(80)  评论:(0)  加入收藏
对于各类开发语言来说,整数都有一个最大的位数,如果超过位数就无法显示或者操作了。其实,这也是一种精度越界之后产生的精度丢失问题。在我们的 PHP 代码中,最大的整数非常大,我...【详细内容】
2021-08-26  硬核项目经理    Tags:PHP   点击:(83)  评论:(0)  加入收藏
遵从所有教材以及各类数据结构相关的书书籍,我们先从线性表开始入门。今天这篇文章更偏概念,是关于有线性表的一个知识点的汇总。上文说过,物理结构是用于确定数据以何种方式存...【详细内容】
2021-07-19  硬核项目经理    Tags:线性表   点击:(94)  评论:(0)  加入收藏
一、开启IIS全部功能。二、部署PHP1.官网下载并解压PHP: https://windows.php.net/downloads/releases/2.将php.ini-development文件改为php.ini3.修改php.ini(1)去掉注释,并修...【详细内容】
2021-07-15  炘蓝火诗  今日头条  Tags:PHP环境   点击:(129)  评论:(0)  加入收藏
一、环境说明本文中使用本地VM虚机部署测试。OS:CentOS Linux release 7.8.2003 (Core)虚机配置:2核CPU、4G内存①系统为CentOS 7.8 x64最小化安装,部署前已完成系统初始化、...【详细内容】
2021-06-25  IT运维笔记  今日头条  Tags:PHP8.0.7   点击:(141)  评论:(0)  加入收藏
最新更新
栏目热门
栏目头条