简体   繁体   English

Xdebug 甚至不尝试连接到端口 9000

[英]Xdebug doesn't even try to connect to port 9000

I have php5-fpm running on Raspberry Pi and serving the web site.我在Raspberry Pi上运行php5-fpm并为 web 站点提供服务。 I have installed php5-xdebug package and restarted php5-fpm and I hope have configured it for remote debug to 127.0.0.1:9000.我已经安装了php5-xdebug package 并重新启动php5-fpm ,我希望已将其配置为远程调试到 127.0.0.1:9000。 I put server on 9000 to listen with nc -l 9000 command.我将服务器放在9000上以使用nc -l 9000命令进行侦听。

Unfortunately, when I open any page with http://mysite/mypage.php?XDEBUG_SESSION=1 nobody event try to connect to port 9000 as it seen by no characters in it's console.不幸的是,当我使用http://mysite/mypage.php?XDEBUG_SESSION=1打开任何页面时,没有人事件尝试连接到端口9000 ,因为它的控制台中没有字符看到它。 The page opens ok.页面打开正常。

What else can prevent PHP debugger from work?还有什么可以阻止 PHP 调试器工作?


Attempts:尝试:

  1. Addition of xdebug.remote_log=/var/log/xdebug.log was indicated on phpinfo page, but had no effect: no any log was created, page was appeared instantly.phpinfo页面上显示了xdebug.remote_log=/var/log/xdebug.log的添加,但没有效果:没有创建任何日志,页面立即出现。

  2. Addition of xdebug_break();添加xdebug_break(); at the beginning of php file also had no effect.php文件的开头也没有效果。 No pauses, no logs.没有停顿,没有日志。

  3. Changing of port didn't change anything...改变端口并没有改变任何东西......


My initial phpinfo was following:我最初的phpinfo如下:

Server API  FPM/FastCGI
Virtual Directory Support   disabled
Configuration File (php.ini) Path   /etc/php5/fpm
Loaded Configuration File   /etc/php5/fpm/php.ini
Scan this dir for additional .ini files /etc/php5/fpm/conf.d
Additional .ini files parsed    /etc/php5/fpm/conf.d/05-opcache.ini, /etc/php5/fpm/conf.d/10-pdo.ini, /etc/php5/fpm/conf.d/20-json.ini, /etc/php5/fpm/conf.d/20-readline.ini, /etc/php5/fpm/conf.d/20-xdebug.ini
PHP API 20131106
PHP Extension   20131226
Zend Extension  220131226
Zend Extension Build    API220131226,NTS
PHP Extension Build API20131226,NTS
Debug Build no
Thread Safety   disabled
Zend Signal Handling    disabled
Zend Memory Manager enabled
Zend Multibyte Support  provided by mbstring
IPv6 Support    enabled
DTrace Support  enabled
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, sslv3, tls, tlsv1.0, tlsv1.1, tlsv1.2
Registered Stream Filters   zlib.*, bzip2.*, convert.iconv.*, string.rot13, string.toupper, string.tolower, string.strip_tags, convert.*, consumed, dechunk
...
***
xdebug
xdebug support  enabled
Version 2.2.5
IDE Key www-data

***
Supported protocols Revision
DBGp - Common DeBuGger Protocol $Revision: 1.145 $
Directive   Local Value Master Value
xdebug.auto_trace   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.extended_info    On  On
xdebug.file_link_format no value    no value
xdebug.idekey   no value    no value
xdebug.max_nesting_level    100 100
xdebug.overload_var_dump    On  On
...
xdebug.remote_autostart Off Off
xdebug.remote_connect_back  Off Off
xdebug.remote_cookie_expire_time    3600    3600
xdebug.remote_enable    On  On
xdebug.remote_handler   dbgp    dbgp
xdebug.remote_host  127.0.0.1   127.0.0.1
xdebug.remote_log   no value    no value
xdebug.remote_mode  req req
xdebug.remote_port  9000    9000
xdebug.scream   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
...

I use xdebug 3. Here are a couple of points that may help others, which I missed initially:我使用 xdebug 3。这里有几点可以帮助其他人,我最初错过了:

  1. If the xdebug log is not created, make sure that log directory is accessible and writable by the apache user.如果未创建 xdebug 日志,请确保 apache 用户可以访问和写入日志目录。 For example /var/log is usually not, so it's better to use /tmp/ like so:例如 /var/log 通常不是,所以最好像这样使用 /tmp/ :

    xdebug.log=/tmp/xdebug.log xdebug.log=/tmp/xdebug.log

  2. to enable xdebug you need to set the mode as well:要启用 xdebug,您还需要设置模式:

    xdebug.mode = debug xdebug.mode = 调试

  3. My final xdebug section is below.我最后的 xdebug 部分如下。 You can change the client_port to apply to your case.您可以更改 client_port 以应用于您的案例。

 zend_extension="/usr/lib64/php/modules/xdebug.so" xdebug.remote_enable=1 xdebug.remote_autostart=on xdebug.client_port=9003 xdebug.log=/tmp/xdebug.log xdebug.client_host=localhost xdebug.discover_client_host = true xdebug.mode = debug,develop

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM