macOS 中使用 phpize 動態新增 PHP 擴充功能的錯誤解決方法

*文
發布: 2023-03-18 07:58:01
原創
1590 人瀏覽過

使用 phpize 動態添加 PHP 擴充功能是開發中經常需要做的事情,但是在 macOS 中,首次使用該功能必然會遇到一些問題,本文將提供了一些常見錯誤的解決方法。

問題一:

執行phpize 錯位如下:

$ 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:
登入後複製

解決方法:

$ ln -s /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/usr/include /usr/include
登入後複製

PS:如果sudo 授權後仍提示沒有操作權限,請查閱macOS 中的Rootless 機制。

問題二:

執行phpize 報錯如下:

$ phpize 
Cannot find autoconf. Please check your autoconf installation and the
$PHP_AUTOCONF environment variable. Then, rerun this script.
登入後複製

解決方法:

先安裝Homebrew :

$ ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
登入後複製

然後安裝autoconf :

$ brew install autoconf
登入後複製

PS:Homebrew 的強大誰用誰知道。不建議手動安裝autoconf 軟體包,因為依賴套件太多~~

mac如何使用homebrew安裝lnmp詳解

##詳解mac使用homebrew安裝MySQL無法登陸問題的解決方法

Mac 10.10 php 使用homebrew安裝後出現問題##以上就是本文的全部內容,大家有疑問的話可以在評論區探討哦~

以上是macOS 中使用 phpize 動態新增 PHP 擴充功能的錯誤解決方法的詳細內容。更多資訊請關注PHP中文網其他相關文章!

相關標籤:
來源:php.cn
本網站聲明
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn
作者最新文章
熱門教學
更多>
最新下載
更多>
網站特效
網站源碼
網站素材
前端模板
關於我們 免責聲明 Sitemap
PHP中文網:公益線上PHP培訓,幫助PHP學習者快速成長!