macOS 中使用 phpize 动态添加 PHP 扩展的错误解决方法

问题一:

执行 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
打赏
Bookmark the permalink.
0 0 投票数
文章评分
订阅评论
提醒
guest

2 评论
内联反馈
查看所有评论
https://wx.qlogo.cn/mmopen/vi_32/ajNVdqHZLLCp7CWIFGwyibaAbn7icUCrQTYTxL8GFmtkrqUdulWUNgCreIvnKiaOzNMjP3MdFXHdve9oadOIKs9IA/0
https://wx.qlogo.cn/mmopen/vi_32/ajNVdqHZLLCp7CWIFGwyibaAbn7icUCrQTYTxL8GFmtkrqUdulWUNgCreIvnKiaOzNMjP3MdFXHdve9oadOIKs9IA/0
5 年 前

https://wx.qlogo.cn/mmopen/vi_32/ajNVdqHZLLCp7CWIFGwyibaAbn7icUCrQTYTxL8GFmtkrqUdulWUNgCreIvnKiaOzNMjP3MdFXHdve9oadOIKs9IA/0
https://wx.qlogo.cn/mmopen/vi_32/ajNVdqHZLLCp7CWIFGwyibaAbn7icUCrQTYTxL8GFmtkrqUdulWUNgCreIvnKiaOzNMjP3MdFXHdve9oadOIKs9IA/0
5 年 前

好吧