简体   繁体   中英

Xdebug doesn't even try to connect to port 9000

I have php5-fpm running on Raspberry Pi and serving the web site. 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. I put server on 9000 to listen with nc -l 9000 command.

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. The page opens ok.

What else can prevent PHP debugger from work?


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.

  2. Addition of xdebug_break(); at the beginning of php file also had no effect. No pauses, no logs.

  3. Changing of port didn't change anything...


My initial phpinfo was following:

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:

  1. If the xdebug log is not created, make sure that log directory is accessible and writable by the apache user. For example /var/log is usually not, so it's better to use /tmp/ like so:

    xdebug.log=/tmp/xdebug.log

  2. to enable xdebug you need to set the mode as well:

    xdebug.mode = debug

  3. My final xdebug section is below. You can change the client_port to apply to your case.

 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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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