【问题标题】:fatal error: 'php.h' file not found when running make on xdebug in MacOS致命错误:在 MacOS 的 xdebug 上运行 make 时找不到“php.h”文件
【发布时间】:2021-09-30 02:15:05
【问题描述】:

我尝试在我的 Mac 上准备好 Xdebug 以用于 PHP 开发,我在官方 Wizard 中输入了 phpinfo() 的输出并按照说明进行操作。 phpize 有效,运行 ./configure 也有效,但我卡在 make 命令输出:

Makefile:230: warning: overriding commands for target `test'
Makefile:134: warning: ignoring old commands for target `test'
/bin/sh ~/Downloads/xdebug-3.0.4/xdebug-3.0.4/libtool --mode=compile cc   -I. -I~/Downloads/xdebug-3.0.4/xdebug-3.0.4 -DPHP_ATOM_INC -I~/Downloads/xdebug-3.0.4/xdebug-3.0.4/include -I~/Downloads/xdebug-3.0.4/xdebug-3.0.4/main -I~/Downloads/xdebug-3.0.4/xdebug-3.0.4 -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib -I~/Downloads/xdebug-3.0.4/xdebug-3.0.4/src  -DHAVE_CONFIG_H  -g -O2   -c ~/Downloads/xdebug-3.0.4/xdebug-3.0.4/xdebug.c -o xdebug.lo 
mkdir .libs
 cc -I. -I~/Downloads/xdebug-3.0.4/xdebug-3.0.4 -DPHP_ATOM_INC -I~/Downloads/xdebug-3.0.4/xdebug-3.0.4/include -I~/Downloads/xdebug-3.0.4/xdebug-3.0.4/main -I~/Downloads/xdebug-3.0.4/xdebug-3.0.4 -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib -I~/Downloads/xdebug-3.0.4/xdebug-3.0.4/src -DHAVE_CONFIG_H -g -O2 -c ~/Downloads/xdebug-3.0.4/xdebug-3.0.4/xdebug.c  -fno-common -DPIC -o .libs/xdebug.o
~/Downloads/xdebug-3.0.4/xdebug-3.0.4/xdebug.c:25:10: fatal error: 'php.h' file not found
#include "php.h"
         ^~~~~~~
1 error generated.
make: *** [xdebug.lo] Error 1

我尝试通过brew安装php-dev包,但是不存在。如何解决这个问题?

【问题讨论】:

    标签: php macos xdebug


    【解决方案1】:

    这是因为 OSX 没有安装扩展编译时需要的 PHP 头文件。我认为您使用的是 OSX 提供的 PHP。

    您应该改用 homebrew 来安装 PHP,它也会安装头文件,然后您可以安装 Xdebug(和其他扩展)。

    这个answer有很好的说明。

    【讨论】:

    • 通过brew install php@7.4 安装PHP 后,我不得不再次运行phpize./configure,现在make 正在工作。 ??
    猜你喜欢
    • 2019-03-08
    • 2022-01-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-07-08
    相关资源
    最近更新 更多