Home>Article>Backend Development> How to install zip extension for php7 under Centos7

How to install zip extension for php7 under Centos7

醉折花枝作酒筹
醉折花枝作酒筹 forward
2021-05-25 09:14:41 3639browse

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.net. If there is any infringement, please contact admin@php.cn delete
Previous article:Why is PHP7 faster than 5? Next article:Why is PHP7 faster than 5?