首页 > 解决方案 > 在 MacOS High Sierra 上安装 xdebug

问题描述

我尝试在我的 Mac 上使用 php 7.2 安装 xdebug,但我无法安装它。我遵循了几个指南,但没有任何效果。

我尝试过的事情:

我得到的主要错误出现在make-step 中(手动运行以及由 pecl 运行时)。

    /bin/sh /Users/my_name/Downloads/xdebug-2.6.0/xdebug-2.6.0/libtool --mode=compile cc   -I. -I/Users/my_name/Downloads/xdebug-2.6.0/xdebug-2.6.0 -DPHP_ATOM_INC -I/Users/my_name/Downloads/xdebug-2.6.0/xdebug-2.6.0/include -I/Users/my_name/Downloads/xdebug-2.6.0/xdebug-2.6.0/main -I/Users/my_name/Downloads/xdebug-2.6.0/xdebug-2.6.0 -I/Applications/XAMPP/xamppfiles/include/php -I/Applications/XAMPP/xamppfiles/include/php/main -I/Applications/XAMPP/xamppfiles/include/php/TSRM -I/Applications/XAMPP/xamppfiles/include/php/Zend -I/Applications/XAMPP/xamppfiles/include/php/ext -I/Applications/XAMPP/xamppfiles/include/php/ext/date/lib  -DHAVE_CONFIG_H  -g -O2   -c /Users/my_name/Downloads/xdebug-2.6.0/xdebug-2.6.0/xdebug.c -o xdebug.lo 
mkdir .libs
 cc -I. -I/Users/my_name/Downloads/xdebug-2.6.0/xdebug-2.6.0 -DPHP_ATOM_INC -I/Users/my_name/Downloads/xdebug-2.6.0/xdebug-2.6.0/include -I/Users/my_name/Downloads/xdebug-2.6.0/xdebug-2.6.0/main -I/Users/my_name/Downloads/xdebug-2.6.0/xdebug-2.6.0 -I/Applications/XAMPP/xamppfiles/include/php -I/Applications/XAMPP/xamppfiles/include/php/main -I/Applications/XAMPP/xamppfiles/include/php/TSRM -I/Applications/XAMPP/xamppfiles/include/php/Zend -I/Applications/XAMPP/xamppfiles/include/php/ext -I/Applications/XAMPP/xamppfiles/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /Users/my_name/Downloads/xdebug-2.6.0/xdebug-2.6.0/xdebug.c  -fno-common -DPIC -o .libs/xdebug.o
In file included from /Users/my_name/Downloads/xdebug-2.6.0/xdebug-2.6.0/xdebug.c:52:
./php_xdebug.h:143:2: error: unknown type name 'zend_long'; did you mean 'zend_ulong'?
        zend_long     max_nesting_level;
        ^~~~~~~~~
        zend_ulong
/Applications/XAMPP/xamppfiles/include/php/Zend/zend_types.h:28:23: note: 'zend_ulong' declared here
typedef unsigned long zend_ulong;
                      ^
In file included from /Users/my_name/Downloads/xdebug-2.6.0/xdebug-2.6.0/xdebug.c:52:
./php_xdebug.h:144:2: error: unknown type name 'zend_long'; did you mean 'zend_ulong'?
        zend_long     max_stack_frames;
        ^~~~~~~~~
        zend_ulong
/Applications/XAMPP/xamppfiles/include/php/Zend/zend_types.h:28:23: note: 'zend_ulong' declared here
typedef unsigned long zend_ulong;
                      ^
In file included from /Users/my_name/Downloads/xdebug-2.6.0/xdebug-2.6.0/xdebug.c:52:
./php_xdebug.h:147:2: error: unknown type name 'zend_long'; did you mean 'zend_ulong'?
        zend_long     collect_params;
        ^~~~~~~~~
        zend_ulong
/Applications/XAMPP/xamppfiles/include/php/Zend/zend_types.h:28:23: note: 'zend_ulong' declared here
typedef unsigned long zend_ulong;
                      ^
In file included from /Users/my_name/Downloads/xdebug-2.6.0/xdebug-2.6.0/xdebug.c:52:
./php_xdebug.h:165:2: error: unknown type name 'zend_long'; did you mean 'zend_ulong'?
        zend_long     force_error_reporting;
        ^~~~~~~~~
        zend_ulong
/Applications/XAMPP/xamppfiles/include/php/Zend/zend_types.h:28:23: note: 'zend_ulong' declared here
typedef unsigned long zend_ulong;
                      ^
In file included from /Users/my_name/Downloads/xdebug-2.6.0/xdebug-2.6.0/xdebug.c:52:
./php_xdebug.h:166:2: error: unknown type name 'zend_long'; did you mean 'zend_ulong'?
        zend_long     halt_level;
        ^~~~~~~~~
        zend_ulong
/Applications/XAMPP/xamppfiles/include/php/Zend/zend_types.h:28:23: note: 'zend_ulong' declared here
typedef unsigned long zend_ulong;
                      ^
In file included from /Users/my_name/Downloads/xdebug-2.6.0/xdebug-2.6.0/xdebug.c:52:
./php_xdebug.h:168:2: error: unknown type name 'zend_long'; did you mean 'zend_ulong'?
        zend_long     overload_var_dump;
        ^~~~~~~~~
        zend_ulong
/Applications/XAMPP/xamppfiles/include/php/Zend/zend_types.h:28:23: note: 'zend_ulong' declared here
typedef unsigned long zend_ulong;
                      ^
In file included from /Users/my_name/Downloads/xdebug-2.6.0/xdebug-2.6.0/xdebug.c:52:
./php_xdebug.h:182:2: error: unknown type name 'zend_long'; did you mean 'zend_ulong'?
        zend_long     trace_options;
        ^~~~~~~~~
        zend_ulong
/Applications/XAMPP/xamppfiles/include/php/Zend/zend_types.h:28:23: note: 'zend_ulong' declared here
typedef unsigned long zend_ulong;
                      ^
In file included from /Users/my_name/Downloads/xdebug-2.6.0/xdebug-2.6.0/xdebug.c:52:
./php_xdebug.h:183:2: error: unknown type name 'zend_long'; did you mean 'zend_ulong'?
        zend_long     trace_format;
        ^~~~~~~~~
        zend_ulong
/Applications/XAMPP/xamppfiles/include/php/Zend/zend_types.h:28:23: note: 'zend_ulong' declared here
typedef unsigned long zend_ulong;
                      ^
In file included from /Users/my_name/Downloads/xdebug-2.6.0/xdebug-2.6.0/xdebug.c:52:
./php_xdebug.h:189:2: error: unknown type name 'zend_long'; did you mean 'zend_ulong'?
        zend_long     display_max_children;
        ^~~~~~~~~
        zend_ulong
/Applications/XAMPP/xamppfiles/include/php/Zend/zend_types.h:28:23: note: 'zend_ulong' declared here
typedef unsigned long zend_ulong;
                      ^
In file included from /Users/my_name/Downloads/xdebug-2.6.0/xdebug-2.6.0/xdebug.c:52:
./php_xdebug.h:190:2: error: unknown type name 'zend_long'; did you mean 'zend_ulong'?
        zend_long     display_max_data;
        ^~~~~~~~~
        zend_ulong
/Applications/XAMPP/xamppfiles/include/php/Zend/zend_types.h:28:23: note: 'zend_ulong' declared here
typedef unsigned long zend_ulong;
                      ^
In file included from /Users/my_name/Downloads/xdebug-2.6.0/xdebug-2.6.0/xdebug.c:52:
./php_xdebug.h:191:2: error: unknown type name 'zend_long'; did you mean 'zend_ulong'?
        zend_long     display_max_depth;
        ^~~~~~~~~
        zend_ulong
/Applications/XAMPP/xamppfiles/include/php/Zend/zend_types.h:28:23: note: 'zend_ulong' declared here
typedef unsigned long zend_ulong;
                      ^
In file included from /Users/my_name/Downloads/xdebug-2.6.0/xdebug-2.6.0/xdebug.c:52:
./php_xdebug.h:246:2: error: unknown type name 'zend_long'; did you mean 'zend_ulong'?
        zend_long     remote_port;    /* 9000 */
        ^~~~~~~~~
        zend_ulong
/Applications/XAMPP/xamppfiles/include/php/Zend/zend_types.h:28:23: note: 'zend_ulong' declared here
typedef unsigned long zend_ulong;
                      ^
In file included from /Users/my_name/Downloads/xdebug-2.6.0/xdebug-2.6.0/xdebug.c:52:
./php_xdebug.h:254:2: error: unknown type name 'zend_long'; did you mean 'zend_ulong'?
        zend_long     remote_cookie_expire_time; /* Expire time for the remote-session cookie */
        ^~~~~~~~~
        zend_ulong
/Applications/XAMPP/xamppfiles/include/php/Zend/zend_types.h:28:23: note: 'zend_ulong' declared here
typedef unsigned long zend_ulong;
                      ^
In file included from /Users/my_name/Downloads/xdebug-2.6.0/xdebug-2.6.0/xdebug.c:52:
./php_xdebug.h:256:2: error: unknown type name 'zend_long'; did you mean 'zend_ulong'?
        zend_long     remote_connect_timeout; /* Timeout in MS for remote connections */
        ^~~~~~~~~
        zend_ulong
/Applications/XAMPP/xamppfiles/include/php/Zend/zend_types.h:28:23: note: 'zend_ulong' declared here
typedef unsigned long zend_ulong;
                      ^
In file included from /Users/my_name/Downloads/xdebug-2.6.0/xdebug-2.6.0/xdebug.c:52:
./php_xdebug.h:313:2: error: unknown type name 'zend_long'; did you mean 'zend_ulong'?
        zend_long     filter_type_tracing;
        ^~~~~~~~~
        zend_ulong
/Applications/XAMPP/xamppfiles/include/php/Zend/zend_types.h:28:23: note: 'zend_ulong' declared here
typedef unsigned long zend_ulong;
                      ^
In file included from /Users/my_name/Downloads/xdebug-2.6.0/xdebug-2.6.0/xdebug.c:52:
./php_xdebug.h:314:2: error: unknown type name 'zend_long'; did you mean 'zend_ulong'?
        zend_long     filter_type_profiler;
        ^~~~~~~~~
        zend_ulong
/Applications/XAMPP/xamppfiles/include/php/Zend/zend_types.h:28:23: note: 'zend_ulong' declared here
typedef unsigned long zend_ulong;
                      ^
In file included from /Users/my_name/Downloads/xdebug-2.6.0/xdebug-2.6.0/xdebug.c:52:
./php_xdebug.h:315:2: error: unknown type name 'zend_long'; did you mean 'zend_ulong'?
        zend_long     filter_type_code_coverage;
        ^~~~~~~~~
        zend_ulong
/Applications/XAMPP/xamppfiles/include/php/Zend/zend_types.h:28:23: note: 'zend_ulong' declared here
typedef unsigned long zend_ulong;
                      ^
In file included from /Users/my_name/Downloads/xdebug-2.6.0/xdebug-2.6.0/xdebug.c:57:
./xdebug_gc_stats.h:23:2: error: unknown type name 'zend_long'; did you mean 'zend_ulong'?
        zend_long    collected;
        ^~~~~~~~~
        zend_ulong
/Applications/XAMPP/xamppfiles/include/php/Zend/zend_types.h:28:23: note: 'zend_ulong' declared here
typedef unsigned long zend_ulong;
                      ^
In file included from /Users/my_name/Downloads/xdebug-2.6.0/xdebug-2.6.0/xdebug.c:57:
./xdebug_gc_stats.h:24:2: error: unknown type name 'zend_long'; did you mean 'zend_ulong'?
        zend_long    duration;
        ^~~~~~~~~
        zend_ulong
/Applications/XAMPP/xamppfiles/include/php/Zend/zend_types.h:28:23: note: 'zend_ulong' declared here
typedef unsigned long zend_ulong;
                      ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
make: *** [xdebug.lo] Error 1

然后我研究了一个运行 xdebug 的 docker 实例,但我没有足够的 docker 经验。

这已经困扰我好几个星期了,我再也看不到了——请帮忙:)

标签: phpxamppxdebug

解决方案


我一直在努力安装 xdebug 以与 XAMPP 一起使用,并且在我之前的一次尝试中看到了这种类型的输出。我不知道这是否适用,但我想我会加两分钱。

从错误输出来看,您似乎在下载文件夹中解压了 xdebug。xdebug 向导说明将其解压缩到 /Applications/XAMPP/xamppfiles/ 文件夹中。这有点帮助,因为您应该从 /Applications/XAMPP/xamppfiles/xdebug-2.6.1/ 文件夹运行 phpize、./configure 等。

为了使 ./configure 工作,我必须做的另一件事是将 /Applications/XAMPP/xamppfiles/bin 放在其他所有内容之前的路径中,以便调用正确的 phpize 命令。之后, ./configure 运行(我认为)没有任何问题。然而,我被向导的“make”指令困住了。事实上,当我看到你的帖子时,我现在正在针对这个问题提出一个问题。希望这可以帮助。


推荐阅读