PhpStorm 和 Xdebug - 无法使用 CLI 脚本运行调试器

PhpStorm & Xdebug - cant get to work debugger with CLI script

这是我第一次post,我post因为阅读了 X 篇文章后谷歌搜索无法获得 PhpStorm,Xdebug 与 CLI 脚本一起工作。

已经尝试遵循以下建议:

我用过,但最近销毁了 vagrant,现在无法完全恢复此功能。

设置:

XDEBUG.INI(在 Vagrant 上):

zend_extension=xdebug.so
xdebug.remote_enable=1
xdebug.remote_host=192.168.0.133 (ip I get from ifconfig -a on Vagrant)
xdebug.remote_port=9000
xdebug.max_nesting_level=2500
xdebug.remote_handler=dbgp
xdebug.remote_autostart=1
xdebug.remote_connect_back=1
xdebug.idekey="PHPSTORM"

非常感谢任何帮助。浏览了网络上的 X 篇文章,但在我看来所有配置看起来都不错,不知道该怎么做...

  1. xdebug.remote_connect_back设为0

    此选项会阻止您在进行远程 CLI 调试时使用正确的 IP 地址。由于它是 CLI 调试,IP 将始终是本地的(流浪机器),而您需要另一个 IP。

    当请求来自您的 "real" 计算机时,此选项在通过浏览器进行调试时工作正常。但是在进行 CLI 调试时.. 请求将在 Vagrant 机器本地。

    当此选项设置为 1 时(就像现在所做的那样),它会忽略下面 #2 中的设置。

  2. xdebug.remote_host=192.168.0.133 (ip I get from ifconfig -a on Vagrant) -- 这应该是您计算机的 IP,其中 PhpStorm 是 运行 从 Vagrant 机器上看到的

以上 2 项的组合将为您完成这项工作。