我的系统版本:
cat /etc/redhat-release
1. 下载PHP安装文件
网址:https://downloads.php.net/~pollita/
wget https://downloads.php.net/~pollita/php-8.0.13RC1.tar.gz
解压:
tar -zxvf php-8.0.13RC1.tar.gz
cd php-8.0.13RC1
安装php的依赖库和安装编译的工具,无论有没有装都可以执行一下,否则你就有可能会像我下面那样遇到很多依赖问题。
yum -y install gcc gcc-c++
yum -y install libxml2-devel openssl-devel curl-devel libjpeg-devel libpng-devel libicu-devel freetype-devel openldap-devel openldap openldap-devel
2. 根据自己的需求配置安装需要的扩展:
./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --enable-mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --enable-fpm --enable-static --enable-sockets --with-zip --enable-calendar --enable-bcmath --enable-mbstring --with-zlib --with-iconv=/usr/local/libiconv --enable-gd --enable-mbstring --with-curl --with-freetype --disable-ipv6 --disable-debug --with-openssl --enable-intl --enable-opcache
配置过程中可能会遇到很多报错信息
注意:如果你提前安装了我上面说的那些依赖,下面这些报错就会少很多。
- 提示缺少依赖 libxml-2.0:
安装:
yum install libxml2-devel