CentOS8.2下如何编译安装PHP8?

CentOS8.2下如何编译安装PHP8?

送给CS8.2下编译PHP8一路报错的小伙伴,请看下文

前提环境:阿里CentOS8.2 64位环境、PHP8源码

一.PHP8源码下载

https://www.php.net/distributions/php-8.0.0.tar.gz

二.安装PHP8依赖包

yum -y install autoconf freetype gd libpng libpng-devel libjpeg libxml2 libxml2-devel zlib curl curl-devel net-snmp-devel libjpeg-devel php-ldap openldap-devel openldap-clients freetype-devel gmp-devel libzip libzip-devel sqlite-devel automake libtool*

三.编译PHP8依赖包oniguruma

1.解压
tar -zxvf oniguruma-6.9.4.tar.gz

2.切换目录
cd oniguruma-6.9.4/

3.生成configure
./autogen.sh

4.生成编译配置文件
./configure –prefix=/usr

5.编译并安装
make && make install

四.编译PHP8主包

1.解压
tar xzf php-8.0.0.tar.gz

2.切换目录
cd php-8.0.0/

3.生成编译配置文件
./configure –prefix=/usr/local/php –with-config-file-path=/usr/local/php/etc –enable-fpm –with-fpm-user=nginx –with-fpm-group=nginx –enable-mysqlnd –with-mysqli –with-pdo-mysql –enable-opcache –with-pcre-jit –enable-gd –with-jpeg –with-freetype –with-gettext –with-curl –with-openssl –enable-sockets –enable-mbstring –enable-xml –with-zip –with-zlib –with-snmp –with-mhash –enable-ftp –enable-bcmath –enable-soap –enable-shmop –enable-sysvsem –enable-pcntl –with-gmp

4.编译并安装
make && make install

五.编译安装后目录

/usr/local/php

到这儿就已经编译完毕了,是不是很爽了,但要特别注意依赖包中的automake和libtool*依赖包,不然PHP8无法编译成功!!!

六.文章中涉及的所有细节和软件包,可详细参考以下课程:

CentOS8 LNMP高性能商用架构,http://www.yzmedu.com/course/390

1 COMMENT

云知梦_强哥

阿里云CS8.2亲测有效,希望对大家有用.

发表评论

邮箱地址不会被公开。 必填项已用*标注

晋公网安备14010902000157号   晋ICP备14001940号-4