Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Xdebug Could not connect to debugging client. Tried: localhost:9000

Tags:

I used before Xdebug v2, but after last update I faced with Xdebug v3.0.0, I replaced all what needed by the update user guide

I'm using Docker.

my debug conf

#xdebug.remote_enable=true xdebug.mode=debug  #xdebug.remote_port=9000 xdebug.client_port=9000  xdebug.remote_host=172.17.0.1  xdebug.remote_handler=dbgp  #xdebug.remote_autostart=1 xdebug.start_with_request=yes  #xdebug.remote_connect_back=0 xdebug.discover_client_host=0  xdebug.idekey=PHPSTORM xdebug.show_error_trace = 1 xdebug.max_nesting_level=250 xdebug.var_display_max_depth=10 #xdebug.remote_mode=req  xdebug.remote_log=/var/log/r_xdebug.log xdebug.log=/var/log/xdebug.log 

and what I get in log when try to execute any PHP script :

tail -f /var/log/xdebug.log [888] Log opened at 2020-11-29 10:39:51.670762 [888] [Step Debug] INFO: Connecting to configured address/port: localhost:9000. [888] [Step Debug] WARN: Creating socket for 'localhost:9000', poll success, but error: Operation now in progress (29). [888] [Step Debug] WARN: Creating socket for 'localhost:9000', connect: Cannot assign requested address. [888] [Step Debug] ERR: Could not connect to debugging client. Tried: localhost:9000 (through xdebug.client_host/xdebug.client_port) :-( [888] Log closed at 2020-11-29 10:39:57.515970 

When I try to execute the URL in a browser PhpStorm does not start debugger, but I checked

lsof -i :9000 | grep LISTEN 

listen port appeared when I click listening in PhpStorm. My conf was sync File | Settings | Languages & Frameworks | PHP | Debug -> Debug port 9000

What's wrong with my Xdebug config and what I need to do?

like image 260
shuba.ivan Avatar asked Nov 29 '20 10:11

shuba.ivan


People also ask

Why is Xdebug not working?

Xdebug cannot connect to PhpStorm This means that Xdebug tries to connect to the host and can't make the connection. To fix the issue, set xdebug. remote_connect_back=0 ( xdebug. discover_client_host=false for Xdebug 3) and make sure that xdebug.

How do I debug using Xdebug?

You can find it in the extension window and install it. After installation, you must reload the VSCode window. Now, again run phpinfo(); method in any PHP file to check if Xdebug is enabled or not. Now click on the debug console tab and click on add configuration.


1 Answers

I just want to share how I migrated from 2.x to 3.x

;Xdebug 2.X ;xdebug.remote_enable=true ;xdebug.remote_port=9000 ;xdebug.remote_host=172.17.0.1 ; ;xdebug.remote_autostart=1 ;xdebug.remote_connect_back=0 ;xdebug.idekey=PHPSTORM ;xdebug.show_error_trace = 1 ;xdebug.max_nesting_level=250 ;xdebug.var_display_max_depth=10 ;xdebug.remote_mode=req   ;Xdebug 3.X xdebug.mode=debug xdebug.client_port=9000 xdebug.client_host=172.17.0.1 xdebug.remote_handler=dbgp xdebug.start_with_request=yes xdebug.discover_client_host=0 xdebug.idekey=PHPSTORM xdebug.show_error_trace = 1 xdebug.max_nesting_level=250 xdebug.var_display_max_depth=10 xdebug.log=/var/log/xdebug.log 
like image 114
shuba.ivan Avatar answered Sep 17 '22 16:09

shuba.ivan