昨天(也就是2018-09-25)新版本的macOS Mojave 10.14正式开放下载,我如此时尚,自然是要第一时间下载安装的(这句话好熟悉的样子)。
今天开发时发现有些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:
缺少PHP的header头文件,再一看/usr/include文件夹根本不存在,想必是Xcode command line tools没有安装完全(我macOS 10.13版本装过的)?熟练的敲出如下命令:
$ xcode-select --install xcode-select: note: install requested for command line developer tools
静等了一会安装完成,一看/usr/include文件夹还是不存在,难道升级系统后System Integrity Protection自动打开导致文件写不进?接着执行:
$ csrutil status System Integrity Protection status: disabled.
SIP处于禁用状态,没有问题。
再安装一遍Xcode com

在更新到macOS Mojave 10.14后,作者在编译PHP扩展时遇到头文件缺失的问题。通过尝试安装Xcode命令行工具并解决权限问题,最终通过安装SDK成功找到头文件,从而解决编译问题。文章详细记录了解决过程,并分享了如何将mac转化为开发环境的经验。
最低0.47元/天 解锁文章
2383

被折叠的 条评论
为什么被折叠?



