1.首先更新依赖包。

yum -y update

2.安装依赖包

yum -y install libxml2 libxml2-devel openssl openssl-devel bzip2 bzip2-devel libcurl libcurl-devel libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel gmp gmp-devel libmcrypt libmcrypt-devel readline readline-devel libxslt libxslt-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel ncurses curl gdbm-devel db4-devel libXpm-devel libX11-devel gd-devel gmp-devel expat-devel xmlrpc-c xmlrpc-c-devel libicu-devel libmcrypt-devel libmemcached-devel libzip gcc-c++
3.转到 /usr/local/src 目录,下载php7.3.5

cd /usr/local/src
wget https://www.php.net/distributions/php-7.3.5.tar.gz
4.解压安装包,并进入目录

tar -zxvf php-7.3.5.tar.gz
cd php-7.3.5
5.添加用户和组

groupadd www
useradd -g www www

6.开始编译

./configure \
--prefix=/usr/local/php\
--enable-fpm\
--with-fpm-user=www\
--with-fpm-group=www\
--with-config-file-path=/usr/local/php/conf\
--disable-rpath\
--enable-soap\
--with-libxml-dir\
--with-xmlrpc\
--with-openssl\
--with-mhash\
--with-pcre-regex\
--with-zlib\
--enable-bcmath\
--with-bz2\
--enable-calendar\
--with-curl\
--enable-exif\
--with-pcre-dir\
--enable-ftp\
--with-gd\
--with-openssl-dir\
--with-jpeg-dir\
--with-png-dir\
--with-zlib-dir\
--with-freetype-dir\
--enable-gd-jis-conv\
--with-gettext\
--with-gmp\
--with-mhash\
--enable-mbstring\
--with-onig\
--with-mysqli=mysqlnd\
--with-pdo-mysql=mysqlnd\
--with-zlib-dir\
--with-readline\
--enable-shmop\
--enable-sockets\
--enable-sysvmsg\
--enable-sysvsem \
--enable-sysvshm \
--enable-wddx\
--with-libxml-dir\
--with-xsl\
--enable-zip\
--with-pear
这里会提示 configure: error: Please reinstall the libzip distribution,我们需要溢出libzip,手动安装最新版本,

先编译安装最新版cmake

cd /usr/local/src
wget https://github.com/Kitware/CMake/releases/download/v3.14.3/cmake-3.14.3.tar.gz
tar -zxvf cmake-3.14.3.tar.gz
cd cmake-3.14.3
./bootstrap
make && make install

再编译安装libzip

yum remove libzip -y
cd /usr/local/src
wget https://libzip.org/download/libzip-1.5.2.tar.gz
tar -zxvf libzip-1.5.2.tar.gz
cd libzip-1.5.2
mkdir build
cd build
cmake ..
make && make install
再次编译php7.3,继续报错 error: off_t undefined; check your library configuration

执行以下命令

vi /etc/ld.so.conf
#添加如下几行
/usr/local/lib64
/usr/local/lib
/usr/lib
/usr/lib64
#保存退出
:wq
ldconfig -v # 使之生效
再次编译PHP7.3

make && make install
7.编译完成后,添加环境变量

vi /etc/profile
#添加以下内容到最后
PATH=$PATH:/usr/local/php/bin
export PATH
#刷新环境变量
source /etc/profile

8.编辑配置文件

cp php.ini-production /usr/local/php/conf/php.ini
cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf
cp /usr/local/php/etc/php-fpm.d/www.conf.default /usr/local/php/etc/php-fpm.d/www.conf
9.把systemctl文件加入开机启动文件

cp sapi/fpm/php-fpm.service /usr/lib/systemd/system/php-fpm.service
systemctl start php-fpm.service
systemctl enable php-fpm.service
 
---------------------
版权声明:本文为CSDN博主「ijijni」的原创文章,遵循CC 4.0 by-sa版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/ijijni/article/details/89913738

centos7 7.3php编译安装的更多相关文章

  1. centos7.2下编译安装&&使用-git代码库

    centos7.2下编译安装git Git简介 Git是一个分布式版本控制系统 Git vs SVN SVN是典型的集中式版本控制起,版本库集中存放在服务器,当我们用自己的电脑干活儿的时候,需要先从中 ...

  2. CentOS-7.3.1611编译安装 Nginx-1.12.1+mysql-5.7.19+PHP-7.1.8+zabbix-3.4.1

    CentOS-7.3.1611编译安装 Nginx-1.12.1+mysql-5.7.19+PHP-7.1.8+zabbix-3.4.1 下载软件 1.下载nginx http://nginx.org ...

  3. Centos7源码编译安装PHP7.2(生产环境)

    安装PHP依赖包,否则在编译的过程中可能会出现各种报错 # Centos 安装epel-release源并将系统包更新到最新版本 $ yum install epel-release-y $ yum ...

  4. centos7源码编译安装lamp/lnmp

    centos7源码编译安装lamp/lnmp 进程:是包工头(相当于是个门,只管开门关门,不管门内的事儿) 线程:是各种工种(cpu调度的是线程) 进程 是一件事情, 线程 是 同一个时间范围内 同时 ...

  5. 尝试在CentOS7.2上编译安装Swift

    苹果提供 Ubuntu上构建Swift 的教程,通过这个教程我尝试使用CentOS7.2上玩儿一把.目前已经成功在CentOS7.2上班成功安装 swift 4.0 https://github.co ...

  6. 最小化安装的centos7.5上编译安装git2.19

    VMware Workstation已经采用最小化安装CentOS7,显示版本为CentOS7.5,准备采用yum安装git. 采用yum list git发现可安装的GIT软件包版本1.8.3.1, ...

  7. centos7.2环境编译安装mysql5.5.48

    一.安装cmake编译工具 跨平台编译器 查看是否已经安装了gcc # rpm -qa | grep gcc # yum install -y gcc-c++ # yum install -y cma ...

  8. centos7 源码编译安装TensorFlow CPU 版本

    一.前言 我们都知道,普通使用pip安装的TensorFlow是万金油版本,当你运行的时候,会提示你不是当前电脑中最优的版本,特别是CPU版本,没有使用指令集优化会让TensorFlow用起来更慢. ...

  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. 【论文阅读】Between-class Learning for Image Classification

    文章:Between-class Learning for Image Classification 链接:https://arxiv.org/pdf/1711.10284.pdf CVPR2018 ...

  2. 继上篇-jquery ajax提交 本篇用ajax提交的数据去数据库查询

    上篇讲到如何用jquery ajax提交数据至后台,后台接收并返回给ajax.https://www.cnblogs.com/tiezhuxiong/p/11943328.html 今天我们把数据传到 ...

  3. Navicat Premium 12连接ubuntu18 ,Mysql 5.7.27-0

    1,搭建好mysql服务器,cd  /etc/mysql/mysql.conf.d,进入mysql配置目录,vim mysqld.cnf 2,注释掉,bind-address =127.0.0.1 , ...

  4. mysqldump工具实现mysql数据库的备份还原

    简介 冷.温.热备份 冷备:读写操作均不可进行 温备:读操作可执行:但写操作不可执行 热备:读写操作均可执行 MyISAM:温备,不支持热备 InnoDB:都支持 不管是热备还原还是冷备还原,还原时都 ...

  5. spring日志体系浅析(spring 5.x)

    日志是进行软件开发必不可少的一项功能,目前流行着很多开源日志库,比如log4j.log4j2.logback.JDK Logging.commons-logging.slf4j等. 几种日志产品的介绍 ...

  6. Linux -- 进程间通信几种方式的总结

    管道 优点 管道文件不占磁盘空间,打开管道时在内存中分配空间: 管道读端会在读取完管道内数据后自动进入阻塞,直到写端再次写入数据: 缺点 管道是半双工的,数据只能从一个方向上流动: 管道大小 PIPE ...

  7. vue JS实现监听浏览器返回按键事件

    // 这个是监听浏览器回退键的returnButton () { let vm = this; $(document).ready(function () { if (window.history & ...

  8. 网页解析--BeautifulSoup练习

    # coding = utf-8 # BeautifulSoup 主要功能是解析提取HTML数据 # re lxml bs4 # pip install Beautifulsoup4 # from b ...

  9. Spring的相关注解

    说明写在最前面:摘录于   博客园--受伤滴小萝卜   文章 文章链接受伤滴小萝卜文章--Spring注解 本文章只用作学习和帮助其他人学习记录使用 Spring 注解学习笔记 声明Bean的注解: ...

  10. 八大机器学习框架对比及Tensorflow的优势

    八大机器学习框架的对比: (1)  TensorFlow:深度学习最流行的库之一,是谷歌在深刻总结了其 前身 DistBelief 的经验教训上形成的:它不仅便携.高效.可扩 展,还能再不同计算机上运 ...