Lar*_*ans 23 php cakephp xdebug
我还没弄明白这一点.我发现的每一篇文档都介绍了如何使用xdebug来调试在Apache中运行的脚本.我需要调试php CLI脚本.
那么,例如,如何传递XDEBUG_SESSION_START变量以使xdebug启动?
我特意尝试调试CakePHP shell.因此,如果有人对此有任何额外的见解,我会非常感激.
谢谢.
Pas*_*TIN 37
在Xdebug的手册中有一些关于它的注释,例如(引用):
export XDEBUG_CONFIG="idekey=session_name"
php myscript.php
Run Code Online (Sandbox Code Playgroud)
如果您使用Eclipse PDT开发和调试PHP脚本,那么Apache或CLI之间没有太大区别:配置lloks完全相同,您不必配置Web服务器,也不必指示URL; 相反,您必须指明PHP可执行文件的路径.
关于XDEBUG_SESSION_START
变量:嗯,你以"调试模式"启动整个脚本,所以你没有任何"调试会话"的概念,我会说.
例如,这就是Window > Preference > PHP > PHP executables
我现在的样子,右边是点击Edit
第一个按钮时得到的:
http://extern.pascal-martin.fr/so/xdebug-cli/1.png http://extern.pascal-martin.fr/so/xdebug-cli/1-edit.png
和debug configurations
窗口:
http://extern.pascal-martin.fr/so/xdebug-cli/2.png
并启动调试:它只是工作:
http://extern.pascal-martin.fr/so/xdebug-cli/3.png
希望这可以帮助 :-)
否则,您遇到什么具体问题?
如果你正在使用bash(或类似的shell),这个小脚本可能会派上用场:
alias drush-debug=drd
function drd {
export XDEBUG_CONFIG="idekey=cli_session"
export SERVER_NAME="developer.machine"
export SERVER_PORT="9000"
drush "$@"
unset XDEBUG_CONFIG
unset SERVER_NAME
unset SERVER_PORT
};
Run Code Online (Sandbox Code Playgroud)
或者如下面的评论员所建议的那样
alias drd='XDEBUG_CONFIG="idekey=PHPSTORM" drush "$@"'
Run Code Online (Sandbox Code Playgroud)
这样,每次要调试时都不必手动设置和取消设置触发器变量.