我們先下載:
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 解決方案