干货,干货,纯干货!
1,下载版本php8
wget https://www.php.net/distributions/php-8.2.3.tar.gz
2,解压
tar -zxvf php-8.2.3.tar.gz
3,安装依赖
yum -y install gcc gcc-c++ libxslt-devel* mod_ssl libtool-ltdl* sqlite-devel oniguruma-devel perl* libzip autoconf
yum -y install libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel curl curl-devel openssl openssl-devel
4,安装PCRE
wget https://github.com/PCRE2Project/pcre2/releases/download/pcre2-10.42/pcre2-10.42.tar.gz
tar zxvf pcre2-10.42.tar.gz
cd pcre2-10.42
./configure --prefix=/usr/local/pcre2 --enable-pcre2-16 --enable-pcre2-32 --enable-jit --enable-jit-sealloc
./configure && make && make install
export PKG_CONFIG_PATH=/usr/local/pcre2/lib/pkgconfig
5,安装libzip
wget https://libzip.org/download/libzip-1.3.2.tar.gz
tar xvf libzip-1.3.2.tar.gz
cd libzip-1.3.2
./configure && make && make install
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig/:$PKG_CONFIG_PATH
6,安装php
cd /home/php-8.2.3/
./configure --prefix=/usr/local/php8 --with-config-file-path=/usr/local/php8/etc --with-curl --with-freetype --with-gd --with-gettext --with-iconv --with-kerberos --with-libdir=lib64 --with-libxml-dir --with-pcre-regex --with-pear --with-png --with-jpeg --with-xmlrpc --with-xsl --with-zlib --with-openssl --enable-fpm --enable-bcmath --enable-libxml --enable-inline-optimization --enable-mbregex --enable-pcntl --enable-shmop --enable-soap --enable-sockets --enable-sysvsem --enable-xml --enable-zip --enable-mbstring --enable-mysqlnd --enable-gd --with-pdo-mysql=mysqlnd --without-sqlite3 --without-pdo_sqlite
make && make install
7,修改环境变量
export PATH=/usr/local/php8/bin:$PATH
8,配置文件
cp /home/php-8.2.3/php.ini-production /usr/local/php8/etc/php.ini
cp /home/php-8.2.3/sapi/fpm/php-fpm /usr/local/php8/etc/php-fpm
cp /usr/local/php8/etc/php-fpm.conf.default /usr/local/php8/etc/php-fpm.conf
cp /usr/local/php8/etc/php-fpm.d/www.conf.default /usr/local/php8/etc/php-fpm.d/www.conf
9,配置启动
cp /home/php-8.2.3/sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm8
chmod a+x php-fpm8
service php-fpm8 start //启动php-fpm
service php-fpm8 stop //停止php-fpm