php7 安装zip扩展,Centos7 下 php7 安装 zip 扩展

论坛 期权论坛 编程之家     
选择匿名的用户   2021-6-2 16:36   2374   0

Centos7 下 php7 安装 zip 扩展

注意安装zlib-devel

参考:

安装:

yum install -y php-devel #用于编译

cd /usr/local/src

wget http://pecl.php.net/get/zip-1.15.3.tgz

tar -zxvf zip-1.15.3.tgz

cd zip-1.15.3

phpize

whereis php-config

./configure --with-php-config=/usr/bin/php-config

报错:configure: error: Please reinstall the libzip distribution。

最新版本请参考官网:https://nih.at/libzip/ ,libzip 需要 cmake 。

yum install -y cmake

cd ../

yum remove libzip

wget https://libzip.org/download/libzip-1.2.0.tar.gz

tar -zxvf libzip-1.2.0.tar.gz

cd libzip-1.2.0.tar.gz

mkdir build && cd build && /usr/local/bin/cmake .. && make && make install

又报错:

CMake Error at CMakeLists.txt:4 (CMAKE_MINIMUM_REQUIRED):

CMake 3.0.2 or higher is required. You are running version 2.8.12.2

-- Configuring incomplete, errors occurred!

cmake版本过低,需新版本。

yum remove cmake

yum install -y cmake3

cmake -version

OK,cmake环境版本升级完毕。

然后再编译 zip 。

cd ../zip-1.15.3

./configure --with-php-config=/usr/bin/php-config

make

make install

安装过程中若出现

fatal error: zipconf.h: No such file or directory

使用命令:

find /usr/local -iname 'zipconf.h'

ln -s /usr/local/lib/libzip/include/zipconf.h /usr/local/include

然后再执行一遍安装即可。最后用命令查看有没有zip.so文件。

ls /usr/lib64/php/modules/

修改 /etc/php.ini :

zlib.output_compression = On

extension=/usr/lib64/php/modules/zip.so

重启 apache:

service httpd restart

再查看 phpinfo,就有 zip 扩展了。

2i0nfxfn31s10940.jpg

分享到 :
0 人收藏
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

积分:3875789
帖子:775174
精华:0
期权论坛 期权论坛
发布
内容

下载期权论坛手机APP