[英]Debugging php-cli scripts with xdebug and netbeans?
我已经设法从IDE本身启动php-cli脚本调试会话,但是我需要从shell /命令行启动调试会话。 这些是相当复杂的维护PHP脚本,需要许多输入参数,因此从Netbeans中输入参数有点麻烦。
我之前在Zend Studio中已经做到了: https : //zend18.zendesk.com/hc/en-us/articles/203838096-Debugging-PHP-CLI-Scripts ,但是现在我需要使其与Netbeans一起使用。
提前致谢。
我通过以下方法在Ubuntu / Netbeans上进行此工作:
export XDEBUG_CONFIG="idekey=netbeans-xdebug"
然后,这只是在netbeans中启动调试并在命令行执行php myscript.php
情况。
注意:如果要使用netbeans进行远程调试,则需要在从命令行运行的文件上使用Debug File,而不是正常的Debug。
将xdebug.remote_autostart=On
添加到您的php.ini文件中,或将-dxdebug.remote_autostart=On
添加为PHP二进制调用的参数( php -d... script.php
)。
我将全部放在一起,以下是对我有用的。
file:
/etc/php5/cli/php.ini
zend_extension="/usr/lib/php5/20121212/xdebug.so" -> xdebug bin path
xdebug.remote_enable=on
xdebug.remote_host=127.0.0.1
xdebug.remote_handler="dbgp"
xdebug.remote_mode="req"
xdebug.remote_port=9000 -> same port configured in netbeans debugging tab
xdebug.idekey="netbeans-xdebug" -> same ide configured in netbeans debuggin tab
xdebug.remote_autostart=1
然后,没有任何其他参数
php脚本.php
我有同样的问题,我的解决方案是这样的:
我有同样的问题,我的解决方案是这样的:
在Netbeans>项目窗口>右键单击php项目>属性>运行配置。 创建一个新配置。
填写正确的值:
如果您不想为IDE配置xDebug(我讨厌配置),则可以使用Dephpugger项目。
https://github.com/tacnoman/dephpugger
您可以在终端中运行调试器,例如python的ipdb和Ruby的byebug。
确保还设置了DBGP_IDEKEY值,因为通常它不是idekey 。 例如在Linux上:
export DBGP_IDEKEY="netbeans-xdebug"
export XDEBUG_CONFIG="netbeans-xdebug=netbeans-xdebug"
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.