使用phpize 動態添加 PHP 擴展是開發中常常須要作的事情,可是在 macOS 中,首次使用該功能必然會碰到一些錯誤,本文列出了這些錯誤的解決方法。php
問題一:git
執行 phpize 報錯以下:github
$ 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:ruby
解決方法:php7
$ ln -s /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/usr/include /usr/includeapp
PS:若是 sudo 受權後仍提示沒有操做權限,請參考文章 macOS 中的 Rootless 機制 。less
問題二:curl
執行 phpize 報錯以下:ide
$ phpize Cannot find autoconf. Please check your autoconf installation and the $PHP_AUTOCONF environment variable. Then, rerun this script. 解決方法:post
先安裝 Homebrew :
$ ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
而後安裝 autoconf :
$ brew install autoconf
PS:Homebrew 的強大誰用誰知道。關於什麼是 Homebrew,以及 Homebrew 的使用,請點擊Homebrew傳送門。不建議手動安裝 autoconf 軟件包,由於依賴包太多~~
Recent posts from the php Quickfix site:
PrestaShop 1.7 starts the Symfony journey for the Community #prestashop, #symfony, #framework, #community Burnout in Tech - Laravel News #burnout, #technology, #developer New in Symfony 3.2: DX improvements (Symfony Blog) #symfony, #developer, #experience, #improvement PHP: rfc:security-classification #rfc, #security, #classification Do you know YAML? | Blog of Leonid Mamchenkov #yaml, #guide, #specification Red Hat will provide PHP 7.0 for RHEL - Remi's RPM repository - Blog #redhat, #php7, #rhel, #product, #release Introducing the SensioLabsInsight commit status on GitHub - SensioLabs Insight Blog