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


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 $PATHSee `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-configconfigure: error: libxml2 not found. Please check your libxml2 installation.[root@localhost php-7.3.4]# rpm -qa|grep libxml2libxml2-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-develchecking for pkg-config... /usr/bin/pkg-configconfigure: error: Cannot find OpenSSL's <evp.h>[root@localhost php-7.3.4]# rpm -qa|grep opensslopenssl-1.0.2k-16.el7.x86_64openssl-libs-1.0.2k-16.el7.x86_64[root@localhost php-7.3.4]# yum install -y openssl-devel已加载插件:fastestmirrorLoading mirror speeds from cached hostfile * base: mirrors.nwsuaf.edu.cn * extras: mirror.lzu.edu.cnchecking for BZip2 in default path... not foundconfigure: error: Please reinstall the BZip2 distribution[root@localhost php-7.3.4]# yum install -y bzip2-devel已加载插件:fastestmirrorLoading mirror speeds from cached hostfile * base: mirrors.cn99.com * extras: mirrors.163.comchecking 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 curlcurl-7.29.0-51.el7.x86_64libcurl-7.29.0-51.el7.x86_64Python-pycurl-7.19.0-19.el7.x86_64[root@localhost php-7.3.4]# yum install -y curl-devel已加载插件:fastestmirrorLoading mirror speeds from cached hostfile * base: mirrors.nwsuaf.edu.cn * extras: mirrors.cn99.comchecking whether to enable JIS-mApped Japanese font support in GD... noIf configure fails try --with-webp-dir=<DIR>configure: error: jpeglib.h not found.[root@localhost php-7.3.4]# yum install -y libjpeg-devel已加载插件:fastestmirrorLoading mirror speeds from cached hostfile * base: mirrors.nwsuaf.edu.cnconfigure: error: png.h not found.[root@localhost php-7.3.4]# yum install -y libpng-devel已加载插件:fastestmirrorIf configure fails try --with-xpm-dir=<DIR>configure: error: freetype-config not found.[root@localhost php-7.3.4]# yum install -y freetype-devel已加载插件:fastestmirrorconfigure: error: xslt-config not found. Please reinstall the libxslt >= 1.1.0 distribution[root@localhost php-7.3.4]# yum install -y libxslt-devel已加载插件:fastestmirrorconfigure: 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 libziplibzip-0.10.1-8.el7.x86_64[root@localhost php-7.3.4]# yum install -y libzip-devel已加载插件:fastestmirrorchecking 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]# lsAPI-CHANGES.md CMakeLists.txt INSTALL.md man srcappveyor.yml cmake-zipconf.h.in lib NEWS.md THANKSAUTHORS examples libzip.pc.in README.md TODO.mdcmake-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 ContributorsC 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 --versioncmake version 3.14.3CMake suite maintained and supported by Kitware (kitware.com/cmake).[root@localhost cmake-3.14.3]#


推荐阅读