1.centOS系统
php安装包目录:/data/php5.6.14/
PHP安装路径:/usr/local/php/
(下面步骤中的具体路径设置,大家根据自己的实际情况设置即可。)
在PHP安装包中找到zip扩展目录
cd /data/php5.6.14/ext/zip/
运行phpize
/usr/local/php/bin/phpize
编译安装:
./configure --with-php-config=/usr/local/php/bin/php-config
make && make install

这时候zip.so就已经在/usr/local/php/lib/php/extensions/no-debug-non-zts-20131226/目录下生成了

设置PHP配置文件php.ini,添加下面一行
extension=zip.so

最后重启服务,使用phpinfo()查看zip扩展是否安装成功。

2.ubuntu
先安装libzip:
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
安装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


设置PHP配置文件php.ini,添加下面一行
extension=zip.so

最后重启web服务。
3.windows系统
下载解压后,将php_zip.dll和php_zip.pdb这两个文件,复制到PHP安装目录下的ext文件夹下。
然后修改php.ini配置文件,载入zip扩展 extension=php_zip.dll,保存后重启服务。

|