Home > Backend Development > PHP7 > body text

How to install zip extension for php7 under Centos7

醉折花枝作酒筹
Release: 2023-02-17 22:44:02
forward
3731 people have browsed it

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
Copy after login

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
Copy after login

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!
Copy after login

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

yum remove cmake
yum install -y cmake3
cmake -version
Copy after login

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
Copy after login

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
Copy after login

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

ls  /usr/lib64/php/modules/
Copy after login

Modify /etc/php.ini:

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

Restart apache:

service httpd restart
Copy after login

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!

Related labels:
source:csdn.net
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template