我在使用Xdebug运行测试时遇到了问题。Xdebug没有停止到断点,它说,在我尝试使用PHPStorm之后,在左侧的下面一个角落,“连接没有建立,不能用'Xdebug 2.8.1‘启动调试器会话
关于我的环境的一些信息:
在我的简历中:
Runtime: PHP 7.4.20 with Xdebug 2.8.1
Scan this dir for additional .ini files => /usr/local/etc/php/7.4/conf.d
Additional .ini files parsed => /usr/local/etc/php/7.4/conf.d/ext-opcache.ini,
/usr/local/etc/php/7.4/conf.d/xdebug.ini
PHP API => 20190902
PHP Extension => 20190902
Zend Extension => 320190902
Zend Extension Build => API320190902,NTS
PHP Extension Build => API20190902,NTS
Debug Build => no
Thread Safety => disabled
Zend Signal Handling => enabled
Zend Memory Manager => enabled
Zend Multibyte Support => provided by mbstring
IPv6 Support => enabled
DTrace Support => available, disabled
Registered PHP Streams => https, ftps, compress.zlib, compress.bzip2, php, file, glob, data, http, ftp, phar, zip
Registered Stream Socket Transports => tcp, udp, unix, udg, ssl, tls, tlsv1.0, tlsv1.1, tlsv1.2, tlsv1.3
Registered Stream Filters => zlib.*, bzip2.*, convert.iconv.*, string.rot13, string.toupper, string.tolower, string.strip_tags, convert.*, consumed, dechunk
This program makes use of the Zend Scripting Language Engine:
Zend Engine v3.4.0, Copyright (c) Zend Technologies
with Zend OPcache v7.4.20, Copyright (c), by Zend Technologies
with Xdebug v2.8.1, Copyright (c) 2002-2019, by Derick Rethans
这是我在phpinfo中找到的xdebug会话。
xdebug
xdebug support => enabled
Version => 2.8.1
IDE Key => bpalumbo
Support Xdebug on Patreon, GitHub, or as a business: https://xdebug.org/support
Supported protocols
DBGp - Common DeBuGger Protocol
Directive => Local Value => Master Value
xdebug.auto_trace => Off => Off
xdebug.cli_color => 0 => 0
xdebug.collect_assignments => Off => Off
xdebug.collect_includes => On => On
xdebug.collect_params => 0 => 0
xdebug.collect_return => Off => Off
xdebug.collect_vars => Off => Off
xdebug.coverage_enable => On => On
xdebug.default_enable => On => On
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.file_link_format => no value => no value
xdebug.filename_format => no value => no value
xdebug.force_display_errors => Off => Off
xdebug.force_error_reporting => 0 => 0
xdebug.gc_stats_enable => Off => Off
xdebug.gc_stats_output_dir => /var/tmp/ => /var/tmp/
xdebug.gc_stats_output_name => gcstats.%p => gcstats.%p
xdebug.halt_level => 0 => 0
xdebug.idekey => no value => no value
xdebug.max_nesting_level => 256 => 256
xdebug.max_stack_frames => -1 => -1
xdebug.overload_var_dump => 2 => 2
xdebug.profiler_aggregate => Off => Off
xdebug.profiler_append => Off => Off
xdebug.profiler_enable => Off => Off
xdebug.profiler_enable_trigger => Off => Off
xdebug.profiler_enable_trigger_value => no value => no value
xdebug.profiler_output_dir => /var/tmp/ => /var/tmp/
xdebug.profiler_output_name => cachegrind.out.%p => cachegrind.out.%p
xdebug.remote_addr_header => no value => no value
xdebug.remote_autostart => Off => Off
xdebug.remote_connect_back => On => On
xdebug.remote_cookie_expire_time => 3600 => 3600
xdebug.remote_enable => On => On
xdebug.remote_handler => dbgp => dbgp
xdebug.remote_host => localhost => localhost
xdebug.remote_log => /usr/local/Cellar/php@7.4/7.4.20/bin/xdebug.log => /usr/local/Cellar/php@7.4/7.4.20/bin/xdebug.log
xdebug.remote_log_level => 7 => 7
xdebug.remote_mode => req => req
xdebug.remote_port => 9000 => 9000
xdebug.remote_timeout => 200 => 200
xdebug.scream => Off => Off
xdebug.show_error_trace => Off => Off
xdebug.show_exception_trace => Off => Off
xdebug.show_local_vars => Off => Off
xdebug.show_mem_delta => Off => Off
xdebug.trace_enable_trigger => Off => Off
xdebug.trace_enable_trigger_value => no value => no value
xdebug.trace_format => 0 => 0
xdebug.trace_options => 0 => 0
xdebug.trace_output_dir => /var/tmp/ => /var/tmp/
xdebug.trace_output_name => trace.%c => trace.%c
xdebug.var_display_max_children => 128 => 128
xdebug.var_display_max_data => 512 => 512
xdebug.var_display_max_depth => 3 => 3
在这里,xdebug日志
[5468] Log opened at 2021-06-11 14:26:14
[5468] I: Checking remote connect back address.
[5468] I: Checking header 'HTTP_X_FORWARDED_FOR'.
[5468] I: Checking header 'REMOTE_ADDR'.
[5468] W: Remote address not found, connecting to configured address/port: 127.0.0.1:9000. :-|
[5468] I: Connected to client. :-)
[5468] -> <init xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" fileuri="file:///Users/bpalumbo/workspace/commercetools-php-sdk/vendor/phpunit/phpunit/phpunit" language="PHP" xdebug:language_version="7.4.0" protocol_version="1.0" appid="5468" idekey="18793"><engine version="2.8.1"><![CDATA[Xdebug]]></engine><author><![CDATA[Derick Rethans]]></author><url><![CDATA[https://xdebug.org]]></url><copyright><![CDATA[Copyright (c) 2002-2019 by Derick Rethans]]></copyright></init>
[5468] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" status="stopping" reason="ok"></response>
[5468] Log closed at 2021-06-11 14:26:15
如果我在这里运行/usr/local/Cellar/php@7.4/7.4.20/bin
,phpize会说(我不知道它是否连接):
Cannot find config.m4.
Make sure that you run '/usr/local/opt/php@7.4/bin/phpize' in the top level source directory of the module
在我的php.ini
中,我没有添加任何关于Xdebug配置的内容,但是我有一个xdebug.ini
,在这里我可以找到:
zend_extension=xdebug.so
我遗漏了什么?
发布于 2021-06-13 06:43:03
根据您的Xdebug日志,您需要将Xdebug端口从默认的9000
更改为其他一些数字(例如,9003
--在Xdebug 3中默认使用)。在PHP (我猜是xdebug.ini)和PhpStorm中都这样做。
在您的计算机上,php似乎已经在使用TCP 9000端口(默认情况下它还使用该端口+在这种情况下可以看到的典型响应),或者其他一些知道Xdebug协议的服务。
自制的意思是麦克,对吧?PhpStorm在检测Mac上已经在使用的端口方面有问题(因此没有来自IDE的警告:在Windows和Linux上,在这种情况下您会看到警告)。您可以通过netstat
或类似程序(例如,Mac上的sudo lsof -nP -iTCP -sTCP:LISTEN
)检查哪个进程使用该端口。
https://stackoverflow.com/questions/67936572
复制