PHPStorm 无法与 xdebug 建立外部连接

2022-01-20 00:00:00 ide xdebug phpstorm

我的操作系统是 Mac Mountain lion.

我的 PhpStorm 版本是 5.0.4.

这是我的 php xdebug 信息:

  • xdebug.remote_autostart => 关闭 => 关闭
  • xdebug.remote_connect_back => 关闭 => 关闭
  • xdebug.remote_cookie_expire_time => 3600 => 3600
  • xdebug.remote_enable => 开启 => 开启
  • xdebug.remote_handler => dbgp => dbgp
  • xdebug.remote_host => 127.0.0.1 => 127.0.0.1
  • xdebug.remote_log => data/logs/xdebug.log => data/logs/xdebug.log
  • xdebug.remote_mode => req => req
  • xdebug.remote_port => 9000 => 9000
  • xdebug.idekey => 没有价值 => 没有价值

我可以在 PhpStorm 中调试 PhpScript 运行类型,它工作正常.所以我认为 xdebug 配置很好.

但是在我尝试按照零配置调试"(Webapplication Run Type)之后,Phpstorm无法连接传入连接.

这是我的步骤:

  1. 单击 Start Listion Php Connection.(将呼叫切换为绿色)
  2. 点击Run->Break at first line in PhpScript,并在第一条语句处设置断点.
  3. 选择 My WebApplication Config 并单击 Debug 按钮.然后它会启动 chrome 并链接到我的 phpscript.(使用 ?XDEBUG_SESSION_START=19869)
  4. 在 PhpStorm 中,调试器显示 Waiting for incoming connection with ide key '19869'.
  5. 在终端中,打印lsof -i4TCP:9000.<块引用>

    命令 PID 用户 FD 类型 设备大小/关闭节点名称
    webide 288 wangfeng 69u IPv6 0xa83881cdce30c579 0t0 TCP *:cslistener (LISTEN)

  6. 打开 Chrome 的开发者工具,选择 Cookies.

    <块引用>

    XDEBUG_SESSION 19869 localhost/2013 年 1 月 30 日星期三 05:27:17 GMT 19

  7. 刷新 Chrome.无法连接到 PhpStorm 调试连接.

补充:

  • 我的防火墙已关闭.
  • 我的服务器是 nginx.我的 phpwebapp 和服务器都在我的本地机器上.

会不会导致ipv6?

希望有所帮助!我已经尝试了所有方法,扩展书签,根本不起作用.

解决方案

9000 端口可能正被其他进程使用.

  1. 在 php.ini 中设置 xdebug.remote_port=9001 或您选择的另一个未使用的端口.
  2. 在 PHPStorm 中转到 Settings->PHP->Debug 并在 Xdebug 部分下将调试端口设置为 9001.
  3. 重新启动您的网络服务器.
  4. 开始调试.

My OS is Mac Mountain lion.

My PhpStorm version is 5.0.4.

Here is my php xdebug info:

  • 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 => data/logs/xdebug.log => data/logs/xdebug.log
  • xdebug.remote_mode => req => req
  • xdebug.remote_port => 9000 => 9000
  • xdebug.idekey => no value => no value

I can debug PhpScript Run Type in PhpStorm,It works fine.So I think xdebug configure well.

But after I try follow the "Zero Configure Debug"(Which with Webapplication Run Type),Phpstorm can not connect with the incoming connection.

Here is my step:

  1. Click Start Listion Php Connection.(Toggle the call to green)
  2. Click Run->Break at first line in PhpScript,and set breakpoint at first statement.
  3. Choose My WebApplication Config and click Debug button.Then it launches chrome and link to my phpscript.(with ?XDEBUG_SESSION_START=19869)
  4. In PhpStorm,Debugger shows Waiting for incoming connection with ide key '19869'.
  5. In termial,printlsof -i4TCP:9000.

    COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
    webide 288 wangfeng 69u IPv6 0xa83881cdce30c579 0t0 TCP *:cslistener (LISTEN)

  6. Open Chrome's Developer Tool,Select Cookies.

    XDEBUG_SESSION 19869 localhost / Wed, 30 Jan 2013 05:27:17 GMT 19

  7. Refresh Chrome.Not able connect with PhpStorm debug connection.

Additional:

  • My firewall was closed.
  • My Server is nginx.My phpwebapp and server is all at my local machine.

Does it cause ipv6?

Hopes help!I have try everything,extensions bookmarklets,not work at all.

解决方案

It's possible that port 9000 is being used by some other process.

  1. In php.ini set xdebug.remote_port=9001 or another unused port of your choosing.
  2. In PHPStorm go to Settings->PHP->Debug and under the Xdebug section set Debug port to 9001.
  3. Restart your web server.
  4. Start debugging.

相关文章