php7.4 源码安装
- 下载php7.4源码包
[root@es_master ~]
- 解压php源码包
tar xvf php-7.4.20.tar.gz
- 安装编译依赖包
yum install sqlite-devel libicu-devel oniguruma oniguruma-devel libxml2-devel gcc build-essential gcc-c++ autoconf automake libxslt-devel
- 编译安装
./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]
/usr/local/services/php7.4
[root@es_master php7.4]
bin etc include lib php sbin test.php var
[root@es_master php7.4]
<?php
echo time();
[root@es_master php7.4]
1626402801[root@es_master php7.4]
- 配置环境变量
ln -s /usr/local/services/php7.4/bin/php /usr/bin/php
1626402801[root@es_master php7.4]
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
|