无法将 Xdebug 3.0.2 与 NetBeans 12.2、PHP 7.4、Ubuntu 20.04 一起使用
Unable to use Xdebug 3.0.2 with NetBeans 12.2, PHP 7.4, Ubuntu 20.04
我想我已经尝试过了,但我无法在 Ubuntu 20.04 上将 Xdebug 与 NetBeans 一起使用,IDE.
如果我使用 phpinfo()
,我可以看到 Xdebug 已启用,这是我的 xdebug.ini 配置文件:
zend_extension=xdebug.so
xdebug.mode=debug
xdebug.start_with_request=yes
xdebug.discover_client_host=0
xdebug.client_port=9000
xdebug.client_host=127.0.0.1
xdebug.remote_handler=dbgp
在 NetBeans 中,我在选项 -> PHP -> 调试中的设置是:
Debugger Port: 9000
Session ID : netbeans-xdebug
Maximum Data Length : 2048
Stop at First Line : unchecked
Watches and Balloon Evaluation : unchecked
Show Requested URLs : checked
Show Debugger Console : checked
我知道这个问题已经被问过很多次了,但大多数都是老问题,none 的答案是有效的。
这让我发疯所以任何帮助将不胜感激!
-- 编辑:
这是 xdebug.log 文件的内容:
[21406] Log opened at 2021-01-21 12:42:36.233357
[21406] [Step Debug] INFO: Connecting to configured address/port: 127.0.0.1:9000.
[21406] [Step Debug] WARN: Creating socket for '127.0.0.1:9000', poll success, but error: Operation now in progress (29).
[21406] [Step Debug] ERR: Could not connect to debugging client. Tried: 127.0.0.1:9000 (through xdebug.client_host/xdebug.client_port) :-(
[21406] Log closed at 2021-01-21 12:42:36.234607
这里是 xdebug_info() 的输出:
PHP
Build Configuration
Version 7.4.14
Debug Build no
Thread Safety disabled
Settings
Configuration File (php.ini) Path /etc/php/7.4/cli
Loaded Configuration File /etc/php/7.4/apache2/php.ini
Scan this dir for additional .ini files /etc/php/7.4/apache2/conf.d
Additional .ini files parsed /etc/php/7.4/apache2/conf.d/10-mysqlnd.ini, /etc/php/7.4/apache2/conf.d/10-opcache.ini, /etc/php/7.4/apache2/conf.d/10-pdo.ini, /etc/php/7.4/apache2/conf.d/15-xml.ini, /etc/php/7.4/apache2/conf.d/20-calendar.ini, /etc/php/7.4/apache2/conf.d/20-ctype.ini, /etc/php/7.4/apache2/conf.d/20-curl.ini, /etc/php/7.4/apache2/conf.d/20-dom.ini, /etc/php/7.4/apache2/conf.d/20-exif.ini, /etc/php/7.4/apache2/conf.d/20-ffi.ini, /etc/php/7.4/apache2/conf.d/20-fileinfo.ini, /etc/php/7.4/apache2/conf.d/20-ftp.ini, /etc/php/7.4/apache2/conf.d/20-gd.ini, /etc/php/7.4/apache2/conf.d/20-gettext.ini, /etc/php/7.4/apache2/conf.d/20-iconv.ini, /etc/php/7.4/apache2/conf.d/20-json.ini, /etc/php/7.4/apache2/conf.d/20-mbstring.ini, /etc/php/7.4/apache2/conf.d/20-mysqli.ini, /etc/php/7.4/apache2/conf.d/20-pdo_mysql.ini, /etc/php/7.4/apache2/conf.d/20-phar.ini, /etc/php/7.4/apache2/conf.d/20-posix.ini, /etc/php/7.4/apache2/conf.d/20-readline.ini, /etc/php/7.4/apache2/conf.d/20-shmop.ini, /etc/php/7.4/apache2/conf.d/20-simplexml.ini, /etc/php/7.4/apache2/conf.d/20-sockets.ini, /etc/php/7.4/apache2/conf.d/20-sysvmsg.ini, /etc/php/7.4/apache2/conf.d/20-sysvsem.ini, /etc/php/7.4/apache2/conf.d/20-sysvshm.ini, /etc/php/7.4/apache2/conf.d/20-tokenizer.ini, /etc/php/7.4/apache2/conf.d/20-xdebug.ini, /etc/php/7.4/apache2/conf.d/20-xmlreader.ini, /etc/php/7.4/apache2/conf.d/20-xmlwriter.ini, /etc/php/7.4/apache2/conf.d/20-xsl.ini
Directive Local Value Master Value Docs
xdebug.mode debug debug
xdebug.start_with_request yes yes
xdebug.start_upon_error default default
xdebug.output_dir /tmp /tmp
xdebug.trigger_value no value no value
xdebug.file_link_format no value no value
xdebug.filename_format no value no value
xdebug.log /var/log/xdebug.log /var/log/xdebug.log
xdebug.log_level 7 7
xdebug.var_display_max_children 128 128
xdebug.var_display_max_data 512 512
xdebug.var_display_max_depth 3 3
xdebug.max_nesting_level 256 256
xdebug.cli_color 0 0
xdebug.force_display_errors Off Off
xdebug.force_error_reporting 0 0
xdebug.halt_level 0 0
xdebug.max_stack_frames -1 -1
xdebug.show_error_trace Off Off
xdebug.show_exception_trace Off Off
xdebug.show_local_vars Off Off
xdebug.dump.COOKIE no value no value
xdebug.dump.ENV no value no value
xdebug.dump.FILES no value no value
xdebug.dump.GET no value no value
xdebug.dump.POST no value no value
xdebug.dump.REQUEST no value no value
xdebug.dump.SERVER no value no value
xdebug.dump.SESSION no value no value
xdebug.dump_globals On On
xdebug.dump_once On On
xdebug.dump_undefined Off Off
xdebug.profiler_output_name cachegrind.out.%p cachegrind.out.%p
xdebug.profiler_append Off Off
xdebug.cloud_id no value no value
xdebug.client_host 127.0.0.1 127.0.0.1
xdebug.client_port 9000 9000
xdebug.discover_client_host Off Off
xdebug.client_discovery_header no value no value
xdebug.idekey no value no value
xdebug.connect_timeout_ms 200 200
xdebug.scream Off Off
xdebug.gc_stats_output_name gcstats.%p gcstats.%p
xdebug.trace_output_name trace.%c trace.%c
xdebug.trace_format 0 0
xdebug.trace_options 0 0
xdebug.collect_assignments Off Off
xdebug.collect_return Off Off
这只是黑魔法,但无论如何,它确实有效。非常感谢
如果它可以帮助任何人,我将 xdebug.idekey 添加到我的 .ini 文件并拥有它 运行 :
- 在 Netbeans 中,我单击“调试项目”按钮,它开始等待 xdebug
- 在我的浏览器 (Chromium) 中,我必须手动启动 url 才能开始调试
我尝试使用 Firefox 而不是 Chromium 进行调试,它按预期工作。
仅供参考:在版本 3 中,Xdebug 的默认调试端口已从 9000 更改为 9003。
来源:https://xdebug.org/docs/upgrade_guide,步骤调试
我想我已经尝试过了,但我无法在 Ubuntu 20.04 上将 Xdebug 与 NetBeans 一起使用,IDE.
如果我使用 phpinfo()
,我可以看到 Xdebug 已启用,这是我的 xdebug.ini 配置文件:
zend_extension=xdebug.so
xdebug.mode=debug
xdebug.start_with_request=yes
xdebug.discover_client_host=0
xdebug.client_port=9000
xdebug.client_host=127.0.0.1
xdebug.remote_handler=dbgp
在 NetBeans 中,我在选项 -> PHP -> 调试中的设置是:
Debugger Port: 9000
Session ID : netbeans-xdebug
Maximum Data Length : 2048
Stop at First Line : unchecked
Watches and Balloon Evaluation : unchecked
Show Requested URLs : checked
Show Debugger Console : checked
我知道这个问题已经被问过很多次了,但大多数都是老问题,none 的答案是有效的。 这让我发疯所以任何帮助将不胜感激!
-- 编辑:
这是 xdebug.log 文件的内容:
[21406] Log opened at 2021-01-21 12:42:36.233357
[21406] [Step Debug] INFO: Connecting to configured address/port: 127.0.0.1:9000.
[21406] [Step Debug] WARN: Creating socket for '127.0.0.1:9000', poll success, but error: Operation now in progress (29).
[21406] [Step Debug] ERR: Could not connect to debugging client. Tried: 127.0.0.1:9000 (through xdebug.client_host/xdebug.client_port) :-(
[21406] Log closed at 2021-01-21 12:42:36.234607
这里是 xdebug_info() 的输出:
PHP
Build Configuration
Version 7.4.14
Debug Build no
Thread Safety disabled
Settings
Configuration File (php.ini) Path /etc/php/7.4/cli
Loaded Configuration File /etc/php/7.4/apache2/php.ini
Scan this dir for additional .ini files /etc/php/7.4/apache2/conf.d
Additional .ini files parsed /etc/php/7.4/apache2/conf.d/10-mysqlnd.ini, /etc/php/7.4/apache2/conf.d/10-opcache.ini, /etc/php/7.4/apache2/conf.d/10-pdo.ini, /etc/php/7.4/apache2/conf.d/15-xml.ini, /etc/php/7.4/apache2/conf.d/20-calendar.ini, /etc/php/7.4/apache2/conf.d/20-ctype.ini, /etc/php/7.4/apache2/conf.d/20-curl.ini, /etc/php/7.4/apache2/conf.d/20-dom.ini, /etc/php/7.4/apache2/conf.d/20-exif.ini, /etc/php/7.4/apache2/conf.d/20-ffi.ini, /etc/php/7.4/apache2/conf.d/20-fileinfo.ini, /etc/php/7.4/apache2/conf.d/20-ftp.ini, /etc/php/7.4/apache2/conf.d/20-gd.ini, /etc/php/7.4/apache2/conf.d/20-gettext.ini, /etc/php/7.4/apache2/conf.d/20-iconv.ini, /etc/php/7.4/apache2/conf.d/20-json.ini, /etc/php/7.4/apache2/conf.d/20-mbstring.ini, /etc/php/7.4/apache2/conf.d/20-mysqli.ini, /etc/php/7.4/apache2/conf.d/20-pdo_mysql.ini, /etc/php/7.4/apache2/conf.d/20-phar.ini, /etc/php/7.4/apache2/conf.d/20-posix.ini, /etc/php/7.4/apache2/conf.d/20-readline.ini, /etc/php/7.4/apache2/conf.d/20-shmop.ini, /etc/php/7.4/apache2/conf.d/20-simplexml.ini, /etc/php/7.4/apache2/conf.d/20-sockets.ini, /etc/php/7.4/apache2/conf.d/20-sysvmsg.ini, /etc/php/7.4/apache2/conf.d/20-sysvsem.ini, /etc/php/7.4/apache2/conf.d/20-sysvshm.ini, /etc/php/7.4/apache2/conf.d/20-tokenizer.ini, /etc/php/7.4/apache2/conf.d/20-xdebug.ini, /etc/php/7.4/apache2/conf.d/20-xmlreader.ini, /etc/php/7.4/apache2/conf.d/20-xmlwriter.ini, /etc/php/7.4/apache2/conf.d/20-xsl.ini
Directive Local Value Master Value Docs
xdebug.mode debug debug
xdebug.start_with_request yes yes
xdebug.start_upon_error default default
xdebug.output_dir /tmp /tmp
xdebug.trigger_value no value no value
xdebug.file_link_format no value no value
xdebug.filename_format no value no value
xdebug.log /var/log/xdebug.log /var/log/xdebug.log
xdebug.log_level 7 7
xdebug.var_display_max_children 128 128
xdebug.var_display_max_data 512 512
xdebug.var_display_max_depth 3 3
xdebug.max_nesting_level 256 256
xdebug.cli_color 0 0
xdebug.force_display_errors Off Off
xdebug.force_error_reporting 0 0
xdebug.halt_level 0 0
xdebug.max_stack_frames -1 -1
xdebug.show_error_trace Off Off
xdebug.show_exception_trace Off Off
xdebug.show_local_vars Off Off
xdebug.dump.COOKIE no value no value
xdebug.dump.ENV no value no value
xdebug.dump.FILES no value no value
xdebug.dump.GET no value no value
xdebug.dump.POST no value no value
xdebug.dump.REQUEST no value no value
xdebug.dump.SERVER no value no value
xdebug.dump.SESSION no value no value
xdebug.dump_globals On On
xdebug.dump_once On On
xdebug.dump_undefined Off Off
xdebug.profiler_output_name cachegrind.out.%p cachegrind.out.%p
xdebug.profiler_append Off Off
xdebug.cloud_id no value no value
xdebug.client_host 127.0.0.1 127.0.0.1
xdebug.client_port 9000 9000
xdebug.discover_client_host Off Off
xdebug.client_discovery_header no value no value
xdebug.idekey no value no value
xdebug.connect_timeout_ms 200 200
xdebug.scream Off Off
xdebug.gc_stats_output_name gcstats.%p gcstats.%p
xdebug.trace_output_name trace.%c trace.%c
xdebug.trace_format 0 0
xdebug.trace_options 0 0
xdebug.collect_assignments Off Off
xdebug.collect_return Off Off
这只是黑魔法,但无论如何,它确实有效。非常感谢
如果它可以帮助任何人,我将 xdebug.idekey 添加到我的 .ini 文件并拥有它 运行 :
- 在 Netbeans 中,我单击“调试项目”按钮,它开始等待 xdebug
- 在我的浏览器 (Chromium) 中,我必须手动启动 url 才能开始调试
我尝试使用 Firefox 而不是 Chromium 进行调试,它按预期工作。
仅供参考:在版本 3 中,Xdebug 的默认调试端口已从 9000 更改为 9003。 来源:https://xdebug.org/docs/upgrade_guide,步骤调试