我需要调试在我的开发VM中运行的控制台脚本(由于机器状态不同)。
我正在使用Netbeans,并且可以调试从浏览器调用的脚本。
您如何实现的,这可能吗?
我尝试了Debugging php-cli scripts with xdebug and netbeans?,但是我认为这仅适用于本地运行脚本。
我当前的xdebug配置:
[XDEBUG]
xdebug.max_nesting_level=200
xdebug.remote_connect_back=1
xdebug.default_enable=1
xdebug.remote_autostart=1
xdebug.remote_enable=1
xdebug.idekey=netbeans-xdebug
xdebug.remote_port=9000
xdebug.remote_handler=dbgp
xdebug.collect_params=4
请您参考如下方法:
因此,遵循此https://www.adayinthelifeof.nl/2012/12/20/debugging-remote-cli-with-phpstorm/,我发现您需要指定远程主机。
Xdebug必须知道将数据发送到哪里。
我最终编辑了xdebug配置,如下所示:
[XDEBUG]
xdebug.max_nesting_level=200
xdebug.remote_connect_back=1
xdebug.default_enable=1
xdebug.remote_enable=1
xdebug.idekey=netbeans-xdebug
xdebug.remote_port=9000
xdebug.remote_handler=dbgp
xdebug.collect_params=4
xdebug.remote_host=HOST_IP #changed this, removed remote_autostart
因此,现在您只需要在Netbeans中打开调试并在VM的控制台中运行
export XDEBUG_CONFIG="idekey=netbeans-xdebug"。
接下来运行您要调试的脚本。




