首页 > 编程知识 正文

mac php phpizeMAC 下 phpize命令出错

时间:2023-05-06 13:44:55 阅读:228908 作者:4810

在安装xdebug的时候,执行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 /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/usr/include    /usr

但是这样执行有可能会没有效果,问题在于 ln命令是为某一个文件在另外一个位置建立一个同步的链接,而/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/usr/include这个地址应该是对应你的php所在的位置,如下图,我的php所在的位置是XAMPP下。

所以命令中的/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/usr/include地址要改成对应的自己的地址/Applications/XAMPP/xamppfiles/include/

最后命令行为sudo ln -s /Applications/XAMPP/xamppfiles/include/  /usr

执行成功后就会在 /user下创建一个include文件的连接连接到对应的位置,然后再运行phpize命令就没有问题了。

(如果出现Operation not permitted的提示,请参考这篇文章https://www.jianshu.com/p/22b89f19afd6)

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。