centos7.9 编译安装php8.1.4

安装前请确保安装了 libzip 和oniguruma

//安装依赖
yum -y install libtool automake epel-release libxml2 libxml2-devel openssl openssl-devel curl-devel libjpeg-devel libpng-devel freetype-devel libmcrypt-devel uuid libuuid-devel gcc bzip2 bzip2-devel gmp-devel  readline-devel libxslt-devel autoconf bison gcc gcc-c++ sqlite-devel
//然后配置用户和组

//创建  www 组 
groupadd www

//新建用户并指定用户组 useradd -g groupname username
useradd -g www www

//下载php 安装包
wget -c https://www.php.net/distributions/php-8.1.4.tar.gz
//解压并进入安装包
tar -zvxf php-8.1.4.tar.gz
cd php-8.1.4

下列编译参数任选其一

编译参数一(推荐)

//这里我们指定了www用户和组 其他的配置参数自行了解
./configure \
--prefix=/usr/local/php/8.1.4 \
--with-config-file-path=/usr/local/php/8.1.4/etc \
--with-config-file-scan-dir=/usr/local/php/8.1.4/etc/conf.d \
--with-fpm-user=www \
--with-fpm-group=www \
--enable-fpm \
--enable-soap \
--with-openssl \
--with-openssl-dir \
--with-zlib \
--with-iconv \
--with-bz2 \
--enable-gd \
--with-jpeg \
--with-freetype \
--with-curl \
--enable-dom \
--with-xml \
--with-zip \
--enable-mbstring \
--enable-pdo \
--with-pdo-mysql \
--with-zlib-dir \
--enable-session \
--enable-shmop \
--enable-simplexml \
--enable-sockets \
--enable-sysvmsg \
--enable-sysvsem \
--enable-sysvshm \
--with-xsl \
--enable-mysqlnd \
--with-mysqli \
--without-pear \
--disable-short-tags
继续阅读