Centos7安装php8.0:

  1. php下载以及安装

下载: http://mirrors.sohu.com/php/
安装包上传/opt 目录下
解压:

tar -zxvf php-8.0.2.tar.gz
yum -y install gcc openssl openssl-devel curl curl-devel libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel pcre pcre-devel libxslt libxslt-devel bzip2 bzip2-devel sqlite-devel
cd /opt/php-8.0.2
./configure --prefix=/data/app/php-cgi \
 --with-config-file-path=/data/app/php-cgi/etc \
 --with-curl \
 --with-freetype-dir \
 --with-gd \ --with-jpeg-dir \
 --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-xmlrpc \
 --with-xsl \
 --with-zlib \
 --enable-fpm \
 --enable-bcmath \
 --enable-libxml \
 --enable-inline-optimization \
 --enable-gd-native-ttf \
 --enable-mbregex \
 --enable-mbstring \
 --enable-opcache \
 --enable-pcntl \
 --enable-shmop \
 --enable-soap \
 --enable-sockets \
 --enable-sysvsem \
 --enable-xml \
 --enable-zip
make
make install

拷贝配置文件

cp php.ini-production /data/app/php-cgi/lib/php.ini
cp /data/app/php-cgi/etc/php-fpm.conf.default /data/app/php-cgi/etc/php-fpm.conf
cp /data/app/php-cgi/etc/php-fpm.d/www.conf.default /data/app/php-cgi/etc/php-fpm.d/www.conf

#启动php

/data/app/php-cgi/sbin/php-fpm