Installing zip extension based on PHP and libzip installation problems

  • 2021-09-12 00:37:27
  • OfStack

Linux:

When php calls the\ ZipArchive class, it needs to install the ZIP extension library, while the zip extension library needs to install libzip first.

Let's download:

wget http://pecl.php.net/get/zip

Download zip, then tar-zvxf zip, and you get zip-1. 14.0 after decompression

cd zip-1.14.0

phpize

Then./configure to see if libzip is missing?

If missing, install libzip, wget https://nih.at/libzip/libzip-1. 2.0. tar.gz first

tar -zxvf libzip-1.2.0.tar.gz

cd libzip-1.2.0

./configure

make

make install

After the installation is complete, you can install zip. If you can't find 'zipconf. h', look for it first, but you can actually find it


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

But why can't I find it? Yes

ln-s/usr/local/lib/libzip/include/zipconf. h/usr/local/include. In this way, zip can be installed.

To modify php. ini, you can call phpinfo () to see which path php. ini is in


extension_dir = "./"

Amend to extension_dir = "/var/zip-1. 14.0/modules"

Add extension = "zip. so"

Restart apache, httpd-k restart


Related articles: