Install php-zip

2019-08-09 10:31:23    Renee    3310

1. CentOS

PHP installed directory: /data/php5.6.14/

PHP installed path: /usr/local/php/

Note: Follow the steps below to install the php-zip extension and change the actual path accordingly. 


Find the zip directory in PHP installation package.


cd /data/php5.6.14/ext/zip/


Run phpize.


/usr/local/php/bin/phpize



Compile and install.



./configure --with-php-config=/usr/local/php/bin/php-config
make && make install



When you see this screenshot above, zip.so has been generated in  /usr/local/php/lib/php/extensions/no-debug-non-zts-20131226/.



Configure php.ini.


extension=zip.so





Restart the service and use phpinfo() to check whether php-zip is installed.


2. Ubuntu

Install libzip first.


sudo wget https://nih.at/libzip/libzip-1.2.0.tar.gz
 sudo tar -zxvf libzip-1.2.0.tar.gz 
cd libzip-1.2.0 
sudo ./configure 
sudo make && sudo make install


Install zip.


sudo wget http://pecl.php.net/get/zip-1.13.5.tgz
sudo tar -zxvf zip-1.13.5.tgz
cd zip-1.13.5
sudo usr/local/php/bin/phpize
sudo ./configure --with-php-config=/usr/local/php/bin/php-config
sudo make && make install




Configure php.ini and add the line as shown in the screenshot below.


Restart the service.


3. Windows

Download the PHP .zip file from  http://pecl.php.net/package/zip and unzip it.


Copy php_zip.dll and php_zip.pdb to /ext in PHP installation directory.


Change php.ini and load extension=php_zip.dll. Save the configuration and restart the service.