【问题标题】:PhpStorm XDebug VirtualBoxPhpStorm XDebug VirtualBox
【发布时间】:2017-07-23 18:31:06
【问题描述】:

在有人抱怨之前,这是一个重复的问题,我的设置:

在 Linux 和 PHP 7 上运行 VirtualBox 的 OS X。

我正在尝试从 Eclipse 迁移到 PhpStorm。调试工作完全符合 Eclipse 的要求,但是我似乎无法使用 PhpStorm 运行它。

PHP 初始化:

[xdebug]
# see http://stackoverflow.com/questions/42656135/xdebug-breakpoint-fail for settings
zend_extension=/usr/lib/php/20151012/xdebug.so
xdebug.remote_enable=true
xdebug.remote_host=192.168.56.1
xdebug.remote_port=10000#port 9000 is usually occupied by FPM, so I recommend to use a different
xdebug.remote_autostart=1
xdebug.idekey=

在尝试进行各种更改时,它会报告以下内容:

18:40   PHP Interpreter is not configured: Please configure PHP Interpreter to use built-in web server

18:54   Can't start listening for connections from 'xdebug': Port 9000 is busy

18:54   Can't start listening for connections from 'Zend Debugger': Port 10137 is busy

18:54   Cannot start 'Zend Debugger Settings Broadcasting': Port 20080 is busy

18:54   Can't start listening for connections from 'xdebug': Port 9000 is busy

18:54   Can't start listening for connections from 'Zend Debugger': Port 10137 is busy

18:54   Cannot start 'Zend Debugger Settings Broadcasting': Port 20080 is busy

18:57   Can't start listening for connections from 'xdebug': Port 9000 is busy

18:57   Can't start listening for connections from 'Zend Debugger': Port 10137 is busy

18:57   Cannot start 'Zend Debugger Settings Broadcasting': Port 20080 is busy

18:58   Can't start listening for connections from 'xdebug': Port 9000 is busy

18:58   Can't start listening for connections from 'Zend Debugger': Port 10137 is busy

18:58   Cannot start 'Zend Debugger Settings Broadcasting': Port 20080 is busy

18:58   Can't start listening for connections from 'xdebug': Port 9000 is busy

18:58   Can't start listening for connections from 'Zend Debugger': Port 10137 is busy

18:58   Cannot start 'Zend Debugger Settings Broadcasting': Port 20080 is busy

【问题讨论】:

  • 1) 那么.. 究竟是什么不起作用(IDE 向您显示什么错误/消息)? 2)你的设置/IDE配置是什么? 3)以防万一:confluence.jetbrains.com/display/PhpStorm/…
  • 好点 LazyOne,已编辑以显示消息
  • 所以..您没有在这些消息中看到任何错误?像 "Can't start listener for connections from 'xdebug': Port 9000 is busy" ?.. 提示:1) 您已将 xdebug (php.ini) 配置为使用端口 10000 但 IDE仍在尝试侦听9000 端口...您是否更改了 PhpStorm 设置中的 xdebug 端口? 2) "Port 9000 is busy" -- 该端口已经被其他服务(可能是您的 php-fmp)监听了......所以 IDE 显然无法监听那个已经在使用的端口。附:不要一次运行多个 IDE(以防它们同时运行)
  • LazyOne ...我发现您的回答对并发进程既有帮助又有帮助,哈哈!!!!当然有突出显示的错误 - 这就是我要问的。基本上,我怎样才能让 PHPStorm 在给定的非本地服务器/IP 和端口上使用 xdebug(即在给定主机定义或 IP 的 VM 上)。 IDE 似乎忽略了我设置的所有内容,因此删除了设置,重新启动了 VM 和主机等
  • 回答这个问题.. 我需要查看您的 IDE 设置。 1) 现在(根据您目前提供的信息)我只能说您需要在 IDE 设置中设置 xdebug 端口以匹配您在 php.ini 中设置的端口。如果不知道您在那里设置了什么,我无法给您任何更好的建议。 2) IDE 也无法监听 Zend Debugger 端口的事实......可能表明本地防火墙的一般问题..或其他已经在这些端口上监听的应用程序(我的第一印象,考虑到所有端口都很忙,是你也运行了 Eclipse)。

标签: php ide phpstorm xdebug


【解决方案1】:

更改 phpstorm 设置以使用端口 10000 进行 xdebug 连接:

停止/开始监听 php 调试连接以使其生效:

如果您仍然收到“端口繁忙”错误,您可以通过在“终端”内运行 lsof -i tcp:10000 来检查阻塞端口的原因(假设您有 OSX ElCapitan+)。

PS:我的 xdebug.ini 中也有 xdebug.idekey=PHPSTORM,在您解决端口问题后,phpstorm 可能会在没有这个的情况下引入连接。

【讨论】:

  • 非常感谢,我还没有机会尝试这个 - 你能否确认 PHPSTORM 可以远程工作,例如在本地机器上使用 VirtualBox 或局域网上的另一个真实机器 - 他们的销售人员今天回复说它不能?
  • 是的,我每天都在使用 vagrant,至少每月一次使用我们的登台服务器
  • PHPStorm 认为端口繁忙,但终端检查显示它空闲
  • IDE 设置在上面添加,我已经设法让它启动,但它似乎没有在端口 10000 上侦听或在断点处停止或确实启动浏览器。上面添加的屏幕截图。
  • 服务器运行一个cron php,所以我禁用了远程启动,但是当重新启用时,调试工作并停止和断点,所以我为什么不能从IDE断点它
猜你喜欢
  • 2015-02-20
  • 1970-01-01
  • 1970-01-01
  • 2014-09-09
  • 2021-03-15
  • 2013-09-02
  • 2014-08-10
  • 2019-03-04
  • 1970-01-01
相关资源
最近更新 更多