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
编译参数解释
--with-fpm-user=webu --with-fpm-group=webg 添加PHP运行用户和用户组
./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”
编译安装
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]#

低调大师中文资讯倾力打造互联网数据资讯、行业资源、电子商务、移动互联网、网络营销平台。
持续更新报道IT业界、互联网、市场资讯、驱动更新,是最及时权威的产业资讯及硬件资讯报道平台。
转载内容版权归作者及来源网站所有,本站原创内容转载请注明来源。
-
上一篇
利用 es6 new.target 来对模拟抽象类
起源 最近在使用 Symbol 来做为唯一值,发现 Symbol 无法进行 new 操作,只能当作函数使用,只要进行了new 就会发生类型错误 new Symbol() // error Uncaught TypeError: Symbol is not a constructor at new Symbol (<anonymous>) at <anonymous>:1:1 在不考虑底层实现的情况下,在代码层面是否能够实现一个函数只可以进行调用而不可以进行 new 操作呢?思考之后如下写出: function disConstructor() { if (this !== window) { throw new TypeError(' disConstructor is not a constructor') } console.log('gogo go') } // 测试结果如下 disConstructor() // gogo go new disConstructor() // error Uncaught TypeError: disConstructo...
-
下一篇
基于环状队列和迭代器实现分布式任务RR分配策略
背景 分布式任务分配 在很多运维场景下,我们都会执行一些长时间的任务,比如装机、部署环境、打包镜像等长时间任务, 而通常我们的任务节点数量通常是有限的(排除基于k8s的hpa、或者knative等自动伸缩场景)。 那么当我们有一个任务如何根据当前的worker和corrdinator和任务来进行合理的分配,分配其实也比较复杂,往复杂里面做,可以根据当前系统的负载、每个任务的执行资源消耗、当前集群的任务数量等, 这里我们就搞一个最简单的,基于任务和当前worker的RR算法 系统架构 在worker和任务队列之间,添加一层协调调度层Coordinator, 由它来根据当前集群任务的状态来进行任务的分配,同时感知当前集群worker和task的状态,协调整个集群任务的执行、终止等操作 单机实现 整体设计 members: 表示当前集群中所有的worker tasks: 就是当前的任务 Coordinator: 就是我们的协调者, 负责根据members和tasks进行任务的分配 result: 就是分配的结果 CircularIterator CircularIterator就是我们的环状...
相关文章
文章评论
共有0条评论来说两句吧...
文章二维码
点击排行
推荐阅读
最新文章
- CentOS7编译安装Cmake3.16.3,解决mysql等软件编译问题
- Red5直播服务器,属于Java语言的直播服务器
- MySQL数据库在高并发下的优化方案
- SpringBoot2全家桶,快速入门学习开发网站教程
- CentOS8编译安装MySQL8.0.19
- Docker使用Oracle官方镜像安装(12C,18C,19C)
- MySQL8.0.19开启GTID主从同步CentOS8
- Springboot2将连接池hikari替换为druid,体验最强大的数据库连接池
- SpringBoot2初体验,简单认识spring boot2并且搭建基础工程
- Dcoker安装(在线仓库),最新的服务器搭配容器使用