目录结构
源码目录:/home/david/php-8.1.3
安装目录:/www/server/php/80
www根目录:/www/wwwroot
www日志目录:/www/wwwlogs
设置权限:sudo chown -R www:www /www
下载源码
# 官网地址:https://www.php.net/downloads.php
wget https://www.php.net/distributions/php-8.1.3.tar.bz2
# 解压源码
tar --bzip -xvf php-8.1.3.tar.bz2 php-8.1.3
cd php-8.1.3
配置编译命令
配置fpm的用户组和用户,以及安装其他扩展
./configure --prefix=/www/server/php/80 \
--with-config-file-path=/www/server/php/80/etc \
--enable-fpm \
--with-fpm-user=www \
--with-fpm-group=www \
--enable-mysqlnd \
--with-mysqli=mysqlnd \
--with-pdo-mysql=mysqlnd \
--enable-mysqlnd-compression-support \
--with-zlib \
--enable-xml \
--disable-rpath \
--enable-bcmath \
--enable-shmop \
--enable-sysvsem \
--with-curl \
--enable-mbregex \
--enable-mbstring \
--enable-intl \
--enable-ftp \
--enable-gd-jis-conv \
--with-openssl \
--with-mhash \
--enable-pcntl \
--enable-sockets \
--enable-soap \
--with-gettext \
--enable-fileinfo \
--enable-opcache \
--with-pear \
--with-ldap=shared \
--without-gdbm
报错Package 'oniguruma', required by 'virtual:world', not found
wget https://github.com/kkos/oniguruma/archive/v6.9.4.tar.gz -O ./oniguruma-6.9.4.tar.gz
tar zxf ./oniguruma-6.9.4.tar.gz
cd oniguruma-6.9.4
./autogen.sh
./configure --prefix=/usr
make && make install
编译安装
make && make install
软连接全局命令
ln -sf /www/server/php/80/sbin/* /usr/local/sbin/
ln -sf /www/server/php/80/bin/* /usr/local/bin/
https://pkgs.org/
https://www.cnblogs.com/architectforest/p/12433640.html
版权属于:大卫科技Blog
本文链接:https://www.iyuu.cn/archives/480/
转载时须注明出处