参考推荐:https://blog.csdn.net/zzz1502/article/details/120157436
首先安装需要的依赖和第三方库
# yum install -y --setopt=protected_multilib=false gcGc gcc-c++ make cmake automake autoconf gd file bison patch mlocate flex diffutils zlib zlib-devel pcre pcre-devel libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel libcurl libcurl-devel e2fsprogs e2fsprogs-devel krb5 krb5-devel kernel-devel libtool-libs readline-devel gettext-devel libcap-devel php-mcrypt libmcrypt libmcrypt-devel recode-devel sqlite-devel oniguruma oniguruma-devel libzip libzip-devel openssl-devel sqlite-devel
到PHP下载页面https://www.php.net/downloads.php
下载php源码
# wget https://www.php.net/distributions/php-8.3.1.tar.gz
解压缩文件
# tar -xzvf php-8.3.1.tar.gz
解压完成进入文件夹
# cd php-8.3
编译安装
# ./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --with-mysqli=shared,mysqlnd --with-pdo-mysql --enable-opcache --enable-gd --with-iconv --with-zip --enable-inline-optimization --disable-debug --disable-rpath --enable-shared --enable-xml --enable-bcmath --enable-shmop --enable-sysvsem --enable-mbregex --enable-mbstring --enable-pcntl --enable-sockets --with-xmlrpc --enable-soap --without-pear --with-gettext --enable-session --with-curl --with-jpeg --with-freetype --enable-fpm --with-fpm-user=nginx --with-fpm-group=nginx --without-gdbm --enable-fast-install --disable-fileinfo --enable-bcmath --with-openssl
编译过程中可能会报错,排查错误一般多是第三方依赖库版本低,或者缺少依赖安装,
错误提示:
1、No package ‘oniguruma’ found
安装
# yum install -y epel-release
# yum install -y oniguruma oniguruma-devel
2 .Requested ‘libzip >= 0.11’ but version of libzip is 0.10.1 libzip 版本太低
yum remove libzip libzip-devel wget https://libzip.org/download/libzip-1.2.0.tar.gz tar -zxvf libzip-1.2.0.tar.gz cd libzip-1.2.0 ./configure make && make install export PKG_CONFIG_PATH="/usr/local/lib/pkgconfig/"
重新执行 ./configure
执行完成后继续执行
# make && make install
出现如下提示信息代表安装成功
Generating files configure: patching main/php_config.h.in configure: creating ./config.status creating main/internal_functions.c creating main/internal_functions_cli.c config.status: creating main/build-defs.h config.status: creating scripts/phpize config.status: creating scripts/man1/phpize.1 config.status: creating scripts/php-config config.status: creating scripts/man1/php-config.1 config.status: creating sapi/cli/php.1 config.status: creating sapi/fpm/php-fpm.conf config.status: creating sapi/fpm/www.conf config.status: creating sapi/fpm/init.d.php-fpm config.status: creating sapi/fpm/php-fpm.service config.status: creating sapi/fpm/php-fpm.8 config.status: creating sapi/fpm/status.html config.status: creating sapi/phpdbg/phpdbg.1 config.status: creating sapi/cgi/php-cgi.1 config.status: creating ext/phar/phar.1 config.status: creating ext/phar/phar.phar.1 config.status: creating main/php_config.h config.status: executing default commands +--------------------------------------------------------------------+ | License: | | This software is subject to the PHP License, available in this | | distribution in the file LICENSE. By continuing this installation | | process, you are bound by the terms of this license agreement. | | If you do not agree with the terms of this license, you must abort | | the installation process at this point. | +--------------------------------------------------------------------+ Thank you for using PHP. configure: WARNING: unrecognized options: --enable-inline-optimization, --with-xmlrpc
标签:status,creating,--,devel,centos7,编译,php8,php,config From: https://www.cnblogs.com/haoxuanchen2014/p/17924345.html