安装PHP7.4.33
系统:CentOS Linux release 7.9.2009 (Core),内核:3.10.0-1127.el7.x86_64
安装过程
1. 通过源码包编译安装, 先下载php-7.4.33
2. 通过yum提前处理各项依赖:
[root@2207013 ~]# yum install -y gcc gcc-c++ epel-release make zlib-devel libxml2-devel libjpeg-devel libpng-devel libwebp-devel \
libXpm-devel freetype-devel libmcrypt-devel openssl-devel libcurl-devel libzip-devel libxslt-devel perl-ExtUtils-MakeMaker autoconf \
sqlite-devel libicu-devel cmake3 automake libtool
可以把yum源修改成国内的镜像地址,参考这篇中的小建议。
3. 进行安装
[root@2207013 data]# tar -zxvf php-7.4.33.tar.gz
[root@2207013 data]# cd php-7.4.33
[root@2207013 php-7.4.33]# ./configure --prefix=/usr/local/php-7.4.33 --with-config-file-path=/usr/local/php-7.4.33/etc --enable-fpm --with-fpm-user=www --with-fpm-group=www \
--with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --enable-gd --with-jpeg --with-webp --with-xpm --with-freetype --with-openssl --with-curl --with-zip --with-xsl --enable-sockets \
--enable-mbstring --with-zip --enable-bcmath --enable-opcache --with-gettext --enable-maintainer-zts --enable-xml --with-libxml --enable-xmlreader --enable-xmlwriter --enable-mysqlnd \
--enable-pcntl --enable-mbregex --enable-intl --with-tsrm-pthreads --with-pic --enable-exif --with-external-pcre
[root@2207013 php-7.4.33]# make && make install
错误处理
执行configure脚本报错处理:
- configure: error: Package requirements (oniguruma) were not met:
No package 'oniguruma' found
[root@2207013 data]# wget https://github.com/kkos/oniguruma/releases/download/v6.9.7/onig-6.9.7.tar.gz
[root@2207013 data]# tar -zxvf onig-6.9.7.tar.gz
[root@2207013 data]# cd onig-6.9.7
[root@2207013 onig-6.9.7]# ./configure
[root@2207013 onig-6.9.7]# make && make install # 注意它安装到哪个目录,这里安装到了/usr/local/lib下
[root@2207013 onig-6.9.7]# export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH
[root@2207013 onig-6.9.7]# pkg-config --modversion oniguruma # 此时可查看安装的oniguruma版本
[root@2207013 onig-6.9.7]# pkg-config --variable pcfiledir oniguruma # 查看安装的oniguruma位置
- checking for libzip >= 0.11 libzip != 1.3.1 libzip != 1.7.0... no
configure: error: Package requirements (libzip >= 0.11 libzip != 1.3.1 libzip != 1.7.0) were not met:
Requested 'libzip >= 0.11' but version of libzip is 0.10.1
[root@2207013 data]# wget https://libzip.org/download/libzip-1.7.3.tar.gz
[root@2207013 data]# tar -zxvf libzip-1.7.3.tar.gz
[root@2207013 data]# cd libzip-1.7.3
[root@2207013 libzip-1.7.3]# mkdir build
[root@2207013 libzip-1.7.3]# cd build
[root@2207013 build]# cmake3 ..
[root@2207013 build]# make && make install
[root@2207013 build]# export PKG_CONFIG_PATH=/usr/local/lib64/pkgconfig:$PKG_CONFIG_PATH
[root@2207013 build]# pkg-config --modversion libzip # 查看libzip版本
- configure: error: Package requirements (libpcre2-8 >= 10.30) were not met:
No package 'libpcre2-8' found
[root@2207013 data]# wget https://github.com/PCRE2Project/pcre2/archive/refs/tags/pcre2-10.33.tar.gz
[root@2207013 data]# tar -zxvf pcre2-pcre2-10.33.tar.gz
[root@2207013 data]# cd pcre2-pcre2-10.33
[root@2207013 pcre2-pcre2-10.33]# ./autogen.sh # 执行这个脚本才会出现configure脚本
[root@2207013 pcre2-pcre2-10.33]# ./configure
[root@2207013 pcre2-pcre2-10.33]# make && make install # 也要注意它安装到哪个目录,这里安装到了/usr/local/lib下
[root@2207013 pcre2-pcre2-10.33]# export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH
[root@2207013 pcre2-pcre2-10.33]# pkg-config --modversion libpcre2-8
标签:pcre2,--,安装,enable,libzip,2207013,PHP,root From: https://www.cnblogs.com/xiaoxiaobug/p/17254741.html