php 7.4编译安装详细版

php 源码包编译安装

首先要安装新版gcc,这是前提,可以看下面这篇文章
https://blog.csdn.net/qq_44335445/article/details/115214003
所需源码包我通过阿里云镜像源的下载链接
http://mirrors.aliyun.com/gnu/

#!/bin/bash
tar xf libtool-2.4.6.tar.gz
cd libtool-2.4.6/
./configure --prefix=/usr
make && make install
libtool --version

tar xf sqlite-autoconf-3360000.tar.gz
cd sqlite-autoconf-3360000
./configure --prefix=/usr
make && make install
sqlite3 -version

yum -y install re2c bison-devel libxml2-devel openssl-devel curl-devel libjpeg-devel libpng-devel freetype-devel pcre-devel libxslt-devel bzip2-devel libargon2-devel pcre2-devel libzip-devel
export PKG_CONFIG_PATH="/usr/lib64/pkgconfig/"
tar xf pcre2-10.37.tar.gz
cd pcre2-10.37/
./configure --prefix=/usr --enable-pcre2-16 --enable-pcre2-32 --enable-pcre2grep-libz --enable-pcre2grep-libbz2
make && make install
pcre2-config --version

yum -y install cmake libzstd-devel zstd nettle-devel gnutls-devel mbedtls-devel 
ldconfig -v
tar xf nettle-3.7.3.tar.gz
cd nettle-3.7.3/
./configure --prefix=/usr
make -j4 && make install

tar xf libzip-1.8.0.tar.gz
cd libzip-1.8.0/
cmake . -DCMAKE_INSTALL_PREFIX=/usr
make && make install
zipcmp -V

tar xf php-7.4.21.tar.gz
cd php-7.4.21/
./configure --prefix=/usr --with-curl --with-freetype --enable-gd --with-jpeg --with-gettext --with-gmp --with-mysqli --with-openssl --with-pdo-mysql --with-pear --with-xmlrpc --with-xsl --with-mhash --enable-fpm --enable-bcmath --enable-mbstring --enable-sockets --enable-xml --enable-embed --enable-phpdbg --with-ldap --with-snmp --with-bz2 --enable-calendar --with-curl --enable-exif --enable-ftp --enable-pcntl --with-zlib --with-readline --enable-shmop --enable-sockets
make && make install
php -m
[PHP Modules]
bcmath
bz2
calendar
Core
ctype
curl
date
dom
exif
fileinfo
filter
ftp
gd
gettext
gmp
hash
iconv
json
ldap
libxml
mbstring
mysqli
mysqlnd
openssl
pcntl
pcre
PDO
pdo_mysql
pdo_sqlite
Phar
posix
readline
Reflection
session
shmop
SimpleXML
snmp
sockets
SPL
sqlite3
standard
tokenizer
xml
xmlreader
xmlrpc
xmlwriter
xsl
zlib

[Zend Modules]
上一篇:php – 如何安装mbstring扩展


下一篇:sh:ffmpeg:通过php运行命令时找不到命令