安装php拓展ext-zip
安装php拓展ext-zip
当安装yunwuxin/think-cron时报错requires ext-zip * -> it is missing from your system.
1 | composer require yunwuxin/think-cron |
安装步骤:
1、下载扩展ext-lib安装包
1 | wget http://pecl.php.net/get/zip-1.20.1.tgz |
2、解压
1 | tar -zvxf zip-1.20.1.tgz |

3、进入目录
1 | cd zip-1.20.1 |
注意:执行phpize时当前环境变量的php路径不要目标安装路径,要指定phpize的完成路径,例如我这里需要改为/www/server/php/73/bin/phpize。
./configure执行时,同样的需要通过--with-php-config=/php/bin/php-config告诉phpize要建立基于哪个版本的扩展。
4、编译安装
1 | make && make install |
5、最后,修改配置文件
然后在php.ini添加一行
1 | extension=zip.so |
如果执行
./configure --with-php-config=/php/bin/php-config发现报错缺少libzip,则需要先安装libzip
1
2
3
4
5
6
7
8
9
10
11 wget https://nih.at/libzip/libzip-1.2.0.tar.gz
tar -zxvf libzip-1.2.0.tar.gz
cd libzip-1.2.0
./configure
make
make install
通用安装方法:php使用phpize安装拓展(https://www.yuencode.cn/2022/06/24/php使用phpize安装拓展/)