下载PHP
下载地址:https://www.php.net/downloads.php
解压安装
# 解压
tar -xzvf php-8.0.0.tar.gz
# 安装依赖
yum install openssl-devel gcc gcc-++ gcc-c++ wget make libxml2 libxml2-devel openssl openssl-devel curl-devel libjpeg-devel libpng-devel freetype-devel bison autoconf sqlite-devel oniguruma-devel
cd php-8.0.0
#选择安装位置等配置
./configure --prefix=/www/server/php/80/ \
--with-config-file-path=/www/server/php/80/etc \
--enable-fpm \
--enable-mysqlnd \
--enable-opcache \
--enable-pcntl \
--enable-mbstring \
--enable-soap \
--enable-zip \
--enable-calendar \
--enable-bcmath \
--enable-exif \
--enable-ftp \
--enable-intl \
--with-mysqli \
--with-pdo-mysql \
--with-openssl \
--with-curl \
--with-gd \
--with-gettext \
--with-mhash \
--with-openssl \
--with-mcrypt \
--with-tidy \
--enable-wddx \
--with-xmlrpc \
--with-zlib
# 安装
make && make install
#配置文件
cp /www/server/php/php-8.0.0/php.ini-production /www/server/php/80/etc/php.ini
#配置/www/server/php/80/etc中php-fpm.conf
问题
1,oniguruma
configure: ERROR: Package requirements (oniguruma) were not met: No
package ‘oniguruma’ found
yum install oniguruma oniguruma-devel
# 如果失败找不到包
yum -y install https://download-ib01.fedoraproject.org/pub/epel/7/x86_64/Packages/o/oniguruma-6.8.2-1.el7.x86_64.rpm
yum -y install https://download-ib01.fedoraproject.org/pub/epel/7/x86_64/Packages/o/oniguruma-devel-6.8.2-1.el7.x86_64.rpm
2, libtidy
configure: error: Cannot find libtidy
yum install libtidy libtidy-devel
# 如果失败找不到包 同上
帮助网站
下载linux依赖网站:https://pkgs.org/
参考文章
centos7 下安装 php8.0, 开启jit
CentOS 编译错误+配置错误解决方法集合
CentOS下编译php时的一些典型错误及解决办法