search
HomeBackend DevelopmentPHP7How to install zip extension for php7 under Centos7

This article will introduce to you how to install the zip extension for php7 under Centos7. It has certain reference value. Friends in need can refer to it. I hope it will be helpful to everyone.

How to install zip extension for php7 under Centos7

Installation:

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

Error report: configure: error: Please reinstall the libzip distribution .

For the latest version, please refer to the official website: https://nih.at/libzip/, libzip requires 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

Another error was reported:

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!

The cmake version is too low and a new version is needed.

yum remove cmake
yum install -y cmake3
cmake -version

OK, the cmake environment version has been upgraded.

Then compile zip.

cd ../zip-1.15.3
./configure --with-php-config=/usr/bin/php-config
make
make install

If

fatal error occurs during the installation process: zipconf.h: No such file or directory

Use command:

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

Then perform the installation again. Finally, use the command to check whether there is a zip.so file.

ls  /usr/lib64/php/modules/

Modify /etc/php.ini:

zlib.output_compression = On
extension=/usr/lib64/php/modules/zip.so

Restart apache:

service httpd restart

Check phpinfo again, there is a zip extension.

zip model

Recommended learning: php video tutorial

The above is the detailed content of How to install zip extension for php7 under Centos7. For more information, please follow other related articles on the PHP Chinese website!

Statement
This article is reproduced at:csdn. If there is any infringement, please contact admin@php.cn delete

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

SublimeText3 English version

SublimeText3 English version

Recommended: Win version, supports code prompts!

VSCode Windows 64-bit Download

VSCode Windows 64-bit Download

A free and powerful IDE editor launched by Microsoft

PhpStorm Mac version

PhpStorm Mac version

The latest (2018.2.1) professional PHP integrated development tool

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools