mac10.15 PHP 安裝zip擴展[安裝其他擴展也可以用到]


我們先下載:

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 //這里可能重置不會生效,可以重啟一下

參考:

  1. https://www.jianshu.com/p/2769f92c956a PHP 安裝 zip 擴展
  2. http://yangjunwei.com/2413.html mac下phpize編譯提示Cannot find autoconf解決辦法
  3. https://www.jianshu.com/p/f4629dc503f7 mac快速安裝PHP擴展
  4. https://blog.csdn.net/worldzhy/article/details/51731539 php phpize報錯
  5. https://www.v2ex.com/t/582276 10.15 遇到的問題
  6. https://pecl.php.net/
  7. https://www.jianshu.com/p/ae863ff9513d mac 安裝pecl
  8. https://www.jianshu.com/p/6ddb9b2cf0ed macOS 上安裝 PECL
  9. https://blog.csdn.net/lucky9322/article/details/79036877 xcode-select --install 解決方案


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM