使用XDebug和PHPStorm调试Symfony2控制台命令 [英] Debugging Symfony2 Console Commands with XDebug and PHPStorm

查看:114
本文介绍了使用XDebug和PHPStorm调试Symfony2控制台命令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我应该如何配置PHPStorm,以便在运行控制台命令时可以使用XDebug跟踪代码?

How should I configure PHPStorm so that I can trace my code using XDebug when running console commands?

我知道我的调试配置正确,因为我可以调试Web请求并跟踪代码.只要设置如下环境变量,我还可以跟踪常规的php命令行脚本:

I know I have the debug configuration correct, because I can debug web requests and trace the code. I can also trace regular php command line scripts as long as I set an environment variable like this:

export XDEBUG_CONFIG="idekey=my-xdebug"

但是,我无法跟踪/调试Symfony2控制台命令(以app/console bundle:console_command运行的命令). PhpStorm看到了连接,但是,似乎无法找到正在运行的代码.我知道我的文件映射是正确的,因为Web请求可以正常工作.

However, I am unable to trace/debug Symfony2 console commands (those run with app/console bundle:console_command). PhpStorm sees the connection, however, it can't seem to locate the code that is being run. I know my file mapping is correct because web requests work flawlessly.

这可能吗?

推荐答案

您应提供SERVER_NAME和SERVER_PORT.您还应该启用xdebug.remote_autostart.试试这个:

You should provide SERVER_NAME and SERVER_PORT. also you should enable xdebug.remote_autostart. Try this:

SERVER_PORT=<Your server port> SERVER_NAME='<Your server name>' php -dxdebug.remote_autostart=On app/console test

这篇关于使用XDebug和PHPStorm调试Symfony2控制台命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆