1.安装相关依赖
dnf -y install autoconf freetype gd libpng libpng-devel libjpeg libxml2 libxml2-devel zlib curl curl-devel net-snmp-devel libjpeg-devel php-ldap openldap-devel openldap-clients freetype-devel gmp-devel libzip libzip-devel sqlite-devel automake libtool*
2.安装oniguruma库
yum install autoconf automake libtool
wget https://github.com/kkos/oniguruma/releases/download/v6.9.8/onig-6.9.8.tar.gz -O oniguruma-6.9.8.tar.gz
tar zxvf oniguruma-6.9.8.tar.gz
cd onig-6.9.8
autoreconf -vfi
./configure --prefix=/usr
make && make install
dnf -y install oniguruma-devel
3.下载php软件包并解压以及编译
wget https://www.php.net/distributions/php-8.2.7.tar.gz
tar zxvf php-8.2.7.tar.gz
cd php-8.2.7
./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --with-mysqli=shared,mysqlnd --with-pdo-mysql --enable-opcache --enable-gd --with-iconv --with-zip --enable-inline-optimization --disable-debug --disable-rpath --enable-shared --enable-xml --enable-bcmath --enable-shmop --enable-sysvsem --enable-mbregex --enable-mbstring --enable-ftp --enable-pcntl --enable-sockets --with-xmlrpc --enable-soap --without-pear --with-gettext --enable-session --with-curl --with-jpeg --with-freetype --enable-fpm --with-fpm-user=nginx --with-fpm-group=nginx --without-gdbm --enable-fast-install --disable-fileinfo
make && make install
4.查看是否安装成功
php -v
如出现如下内容,则安装成功
PHP 8.0.28 (cli) (built: Feb 14 2023 11:05:44) ( NTS )
Copyright (c) The PHP Group
Zend Engine v4.0.28, Copyright (c) Zend Technologies
with Zend OPcache v8.0.28, Copyright (c), by Zend Technologies