centos7 编译安装 php7.4
1. 下载安装编译工具
yum groupinstall 'Development Tools'
2.安装依赖包
yum 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
3.下载并解压php7.4
wget http://php.net/distributions/php-7.4.0.tar.gz
tar -zxvf php-7.4.0.tar.gz
cd php-7.4.0
4.编译安装(./configure --help 查看编译参数)
编译前,新增用户组,用户,用于编译使用
groupadd www
useradd -g www www
开始编译(根据自己需要增减)
./configure \
--prefix=/usr/local/php \
--with-config-file-path=/etc \
--with-fpm-user=www \
--with-fpm-group=www \
--with-curl \
--with-freetype-dir \
--enable-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-zlib \
--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-zip \
--enable-fpm
这里需要注意的是在php7.4 编译参数 --with-gd 要改成了 --enable-gd
当报错checking for libzip... configure: error: system libzip must be upgraded to version >= 0.11
#先删除旧版本
yum remove -y libzip #下载编译安装
wget https://nih.at/libzip/libzip-1.2.0.tar.gz
tar -zxvf libzip-1.2..tar.gz
cd libzip-1.2.
./configure
make && make install
error: Package requirements (sqlite3 > 3.7.4) were not met
yum install libsqlite3x-devel -y
error: Package requirements (oniguruma) were not met
yum install oniguruma-devel -y
当yum install 提示 "没可用软件包"
yum install -y epel-release
off_t undefined 报错
configure: error: off_t undefined; check your library configuration
off_t 类型是在 头文件 unistd.h中定义的,
在32位系统 编程成 long int ,64位系统则编译成 long long int ,
在进行编译的时候 是默认查找64位的动态链接库,
但是默认情况下 centos 的动态链接库配置文件/etc/ld.so.conf里并没有加入搜索路径,
这个时候需要将 /usr/local/lib64 /usr/lib64 这些针对64位的库文件路径加进去。
#添加搜索路径到配置文件
echo '/usr/local/lib64
/usr/local/lib
/usr/lib
/usr/lib64'>>/etc/ld.so.conf #然后 更新配置
ldconfig -v
/usr/local/include/zip.h:59:21: fatal error: zipconf.h: No such file or directory
cp /usr/local/lib/libzip/include/zipconf.h /usr/local/include/zipconf.h
编译没问题了,执行make && make install 安装完毕
5.配置环境
执行完安装命令后php7.4就已经安装在到了/usr/local/php目录下了
/usr/local/php/bin/php -v
查看版本
添加环境变量
vim /etc/profile
添加到最后
PATH=$PATH:/usr/local/php/bin
export PATH
更新环境变量
source /etc/profile
查看版本
php -v
6.配置php-fpm
cp php.ini-production /etc/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
cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
chmod +x /etc/init.d/php-fpm
启动php-fpm
/etc/init.d/php-fpm start
或者
service php-fpm start
centos7 编译安装 php7.4的更多相关文章
- Centos7 编译安装PHP7
Centos7 编译安装PHP7 编译安装的方式可以让组件等设置更加合理,但需要你对PHP的代码及各种配置非常的熟悉,以下为大致的安装流程,大家可以参考 1.下载编译工具 yum groupinsta ...
- CentOS7编译安装php7.1配置教程详解
这篇文章主要介绍CentOS7编译安装php7.1的过程和配置详解,亲测 ,需要的朋友可以参考. 1.首先安装依赖包: yum install libxml2 libxml2-devel openss ...
- CentOS7 编译安装 php7
更新:2019-01-25 补充:CentOS 7.5 全新编译安装 PHP-7.3.1 ,补充内容接在原文之后 更新:2018-09-29 补充:新系统下编译安装PHP-7.2.5遇到的问题,补充内 ...
- CentOS7编译安装php7.1
1.首先安装依赖包: yum install libxml2 libxml2-devel openssl openssl-devel bzip2 bzip2-devel libcurl libcurl ...
- centos7 编译安装 php7.3.11
1.安装依赖 yum install -y libxml2 *openssl* libcurl* libjpeg* libpng* freetype* libmcrypt* gcc gcc-c++ 2 ...
- centos7编译安装PHP7已经把你逼到去安定医院看门诊的地步?请看此文
本文援引自https://www.cnblogs.com/lamp01/p/10101659.html,亲测可行,特此鸣谢 地球上总有一群人是如此深爱PHP,但无奈的是编译安装的过程化特性,导致各种b ...
- centos7编译安装php7.2
去官网下载php7.2安装包,选择一个结点下载:http://php.net/downloads.php 下载:wget -ivh http://cn.php.net/distributions/ph ...
- CentOs7 编译安装PHP7.1.5
1 创建php用户和用户组,并在github下载php7源码 #######新建php用户和php组 [root@typecodes ~]# groupadd -r www && us ...
- Centos7 编译安装PHP7.2
yum install wget 在 /usr/local/src 目录下载php源码包 wget http://cn2.php.net/distributions/php-7.2.4.tar.gz ...
随机推荐
- hdu 4419 Colourful Rectangle (离散化扫描线线段树)
Problem - 4419 题意不难,红绿蓝三种颜色覆盖在平面上,不同颜色的区域相交会产生新的颜色,求每一种颜色的面积大小. 比较明显,这题要从矩形面积并的方向出发.如果做过矩形面积并的题,用线段树 ...
- oracle用索引提高效率
索引是表的一个概念部分,用来提高检索数据的效率. 实际上,ORACLE使用了一个复杂的自平衡B-tree结构. 通常,通过索引查询数据比全表扫描要快. 当ORACLE找出执行查询和Update语句的最 ...
- jqLite
一.关于DOM导航的jqLite方法 children() 返回一组子元素.这个方法的jqLite实现不支持jQuery所提供的选择器特性 eq(index) 从一个元素集合中返回指定索引下的元素 f ...
- angular input框点击别处 变成不可输入状态
<input type="text" ng-model="edit" ng-disabled="!editable" focus-me ...
- W3C vs IE盒模型
今年4月份的一次面试,问到盒模型,是我第一次接触到盒模型,但当时不太明白,没有说清楚,后来查了下,但一知半解. 下面分享下,我对盒模型的理解: 盒模型,也就是box-sizing,分为content- ...
- 详解ThinkPHP支持的URL模式有四种普通模式、PATHINFO、REWRITE和兼容模式
URL模式 URL_MODEL设置 普通模式 0 PATHINFO模式 1 REWRITE模式 2 兼容模式 3 如果你整个应用下面的模块都是采用统一的URL模式 ...
- java final域
public final class ThreeStooges { /* * stooges是Set<String>类型的引用,final限定该引用成员属性stooges被赋初值后,就不能 ...
- redis_Cacha 爬虫链接redis配置文件
import redisimport json class RedisCache(object): """ 使用redis进行爬虫结果的缓存,并可以进行增量爬取 &quo ...
- H3C 域名解析显示及维护
- 读《Effect Java中文版》
读<Effect Java中文版> 译者序 序 前言 第1章引言 1 第2章创建和销毁对象 4 第1条:考虑用静态工厂方法代替构造函数 4 第2条:使用私有构造函数强化singleto ...