您的位置:首页 > 编程语言 > PHP开发

关于Mac安装PHP相关扩展出现Zend/zend_config.h缺失的问题记录

2017-01-16 16:14 876 查看
Mac升级之后,系统自带的php版本也会随之升级,我用的就是系统自带的版本

麻烦的是扩展在版本变更后需要重新编译安装
重新安装redis xdebug 等扩展时却会遇到各种头文件缺失的问题

之前从php官网下载php源码包解压之后,放到提示缺失文件的目录中,就可以解决这个问题。
后来也有自己重新编译覆盖安装过PHP,不过感觉都比较繁琐,...

常见的错误提示如下(redis)

In file included from /usr/include/php/main/php.h:35:
/usr/include/php/Zend/zend.h:51:11: fatal error: 'zend_config.h' file not found
# include <zend_config.h>
^
1 error generated.
make: *** [redis.lo] Error 1

网上搜索之后,从各种参考资源中发现了这个,感觉可以试试

I finally managed to install xdebug. In fact, I had to install Xcode developer tool and then copy the files from
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk/usr/include/php into /Applications/MAMP/bin/php/php5.4.4/include
and then it worked !

于是在Xcode对应的目录看了看,确实有类似的目录存在。
拷贝至相应的目录后,编译安装通过。 仅以此备忘。

友情提示: 注意观察错误提示, 参考的资料与自己的情况通常都有差距,举一反三很重要 :)
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  php extension redis