我们先下载:
wget http://pecl.php.net/get/zip
下载了zip,然后
tar -zvxf zip
,就得到解压后的zip-1.15.1
cd zip-1.15.1 phpize
遇到报错
grep: /usr/include/php/main/php.h: No such file or directory grep: /usr/include/php/Zend/zend_modules.h: No such file or directory grep: /usr/include/php/Zend/zend_extensions.h: No such file or directory Configuring for: PHP Api Version: Zend Module Api No: Zend Extension Api No:
先关闭系统安全,然后执行命令
sudo ln -s /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/ /usr
执行
phpize
报错
Configuring for: PHP Api Version: 20121113 Zend Module Api No: 20121212 Zend Extension Api No: 220121212 Cannot find autoconf. Please check your autoconf installation and the
安装
brew install autoconf
执行
phpize // 有可能会报错 libzip缺少
安装
// brew不存在需要单独安装 brew install libzip
然后再执行
phpize ./configure make && make install
开启php扩展:
sudo nano /etc/php.ini # ext... zip sudo apachectl restart //这里可能重置不会生效,可以重启一下
参考:
- https://www.jianshu.com/p/2769f92c956a PHP 安装 zip 扩展
- http://yangjunwei.com/2413.html mac下phpize编译提示Cannot find autoconf解决办法
- https://www.jianshu.com/p/f4629dc503f7 mac快速安装PHP扩展
- https://blog.csdn.net/worldzhy/article/details/51731539 php phpize报错
- https://www.v2ex.com/t/582276 10.15 遇到的问题
- https://pecl.php.net/
- https://www.jianshu.com/p/ae863ff9513d mac 安装pecl
- https://www.jianshu.com/p/6ddb9b2cf0ed macOS 上安装 PECL
- https://blog.csdn.net/lucky9322/article/details/79036877 xcode-select --install 解决方案