centos7系统下php7.4源码安装

php7.4 源码安装
  1. 下载php7.4源码包
[root@es_master ~]# wget https://www.php.net/distributions/php-7.4.20.tar.gz
  1. 解压php源码包
tar xvf php-7.4.20.tar.gz
  1. 安装编译依赖包
yum install sqlite-devel libicu-devel oniguruma oniguruma-devel libxml2-devel gcc build-essential gcc-c++ autoconf automake libxslt-devel 
  1. 编译安装
./configure  --prefix=/usr/local/services/php7.4 --with-config-file-path=/usr/local/services/php7.4/etc --with-config-file-scan-dir=/usr/local/services/php7.4/etc/php.d --with-fpm-user=www --with-fpm-group=www --enable-fpm --enable-opcache --disable-fileinfo --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --with-iconv-dir=/usr/local --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-exif --enable-sysvsem --enable-inline-optimization --with-curl=/usr/local --enable-mbregex --enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-ftp --enable-intl --with-xsl --with-gettext --enable-zip --enable-soap --disable-ipv6 --disable-debug   (安装目录没有需要手动创建)
make 
看一下echo $?是否为0
make install

在这里插入图片描述编译成功如图所示
5. 测试

[root@es_master src]# cd -
/usr/local/services/php7.4
[root@es_master php7.4]# ls
bin  etc  include  lib  php  sbin  test.php  var
[root@es_master php7.4]# cat test.php 
<?php
echo time();
[root@es_master php7.4]# ./bin/php test.php 
1626402801[root@es_master php7.4]#  
  1. 配置环境变量
ln -s /usr/local/services/php7.4/bin/php /usr/bin/php
1626402801[root@es_master php7.4]# php -v
PHP 7.4.20 (cli) (built: Jul 15 2021 18:31:54) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies

此内容部分摘抄自 https://blog.csdn.net/qq_38018165/article/details/89914778

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值