简体   繁体   中英

Phpstorm, xdebug and vagrant still waiting for incoming connection

This is annoying me, mainly because it was working fine then all of a sudden breakpoints stopped breaking and when i checked debugger it was just waiting for incoming connection.

My vagrant machine is running on private_ip: 192.168.13.37

My xdebug.ini config is as follows:

zend_extension=/usr/lib/php5/20090626+lfs/xdebug.so
xdebug.remote_enable = on
xdebug.remote_connect_back = on
xdebug.remote_port = 9020

These are my PHPstorm debug settings: 在此输入图像描述

I have a vagrant server setup in PHPstorm which has a host of dev.website.com which points at the correct IP in windows host file, the port is 80 and the folders are mapped correctly.

I also have PHP application set up to use the explained server which a start url of / .

I have clicked start listening for PHP debug connections, then clicked the little green bug icon to start debugging. This launches the project with the following query string ?XDEBUG_SESSION_START=18359 but when I look in PHPstorm in the debug window it will say waiting for incoming connection with ide key 18359

Any ideas how to get it working again?

Edit Added xdebug log : pastebin

Had identical problem, what helped me is setting :

xdebug.remote_autostart = 1

my other settings are:

zend_extension=xdebug.so
xdebug.remote_enable=1
xdebug.remote_connect_back=1
xdebug.remote_port=9010
xdebug.idekey=phpstorm
xdebug.remote_autostart = 1
xdebug.remote_handler=dbgp
xdebug.remote_host=10.0.2.2

You say you have a server setup pointing to port 80? That could be the problem.

I have a vagrant server setup in PHPstorm which has a host of dev.website.com which points at the correct IP in windows host file, the port is 80 and the folders are mapped correctly.

Do you use PHP Remote Debug? 在此输入图像描述

If it's the server setup from the screenshot, change the port there to 9020 or whatever you desire to use.


My First steps of checking why xDebug isn't working:

Set Break at first Line in the PHPStorm preferences

preferences->languages&frameworks->PHP->debug ( search break at first )

Enable the break at first Line feature

Still not working?

What does your phpinfo say? Is xDebug enabled and do all the settings match?

phpinfo()

If not try this https://xdebug.org/wizard.php and check out this Tutorial

If so try

Is there maybe a firewall blocking your port?

No? ok ->

vagrant ssh 
netstat -an | grep 9000

Check if the port is listening and is not blocked by anything.

I would recommend using port 9000, had issues with others.

I recently had an issue with hhvm blocking the port. I purged it from the system.

If everything looks fine, try to use phpstorms remote debug feature and map explicitly your index.php file of your project/s.


Also maybe try not to use numeric values as your idekey

XDEBUG_SESSION_START=18359

Most people use something like this:

XDEBUG_SESSION_START=PHPSTORM

you can add an idekey to your xdebug.so would look like this

xdebug.idekey=PHPSTORM

Small list with xdebug parameters: https://xdebug.org/docs/basic

My current projects phpstorm config looks like this: 在此输入图像描述


This is a plugin for setting the session cookie in the browser https://chrome.google.com/webstore/detail/xdebug-helper/eadndfjplgieldjbigjakmdgkmoaaaoc

I had a problem very similar with my two hosts on remote server.

One was called dev.host.com, the other 123.host.com (which was corresponding to a temporary version number).

My problem was that dev.host.com was working perfectly fine with xdebug in phpstorm while the other host was always waiting for incoming connection.

I spent some hours to look why, but found nothing concluant by changing my xdebug parameters, my phpstorm conf, my folders permissions,... until I renamed my 123.host.com with some alphabetical characters like 'abc.host.com' and..... it started working !

So I would advise you to be careful with the name you choose for your host, I think it was not mapped correctly... Weird but solved on my side.

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