问题
我想在远程VM服务器上调试Symfony控制台命令。我可以调试bin/console
脚本以及\Symfony\Bundle\FrameworkBundle\Console\Application
中的所有相关方法调用,但只要它调用特定命令的执行方法(在symfony/symfony/src/Symfony/Component/Console/Command/Command.php:256
中)调试器映射以某种方式丢失映射并且不再起作用。我无法在我在特定命令设置的任何断点处打破它。
设置
在VM上我有以下php设置:
# /etc/php5/cli/php.ini
[xdebug]
zend_extension=/usr/lib/php5/20131226/xdebug.so
xdebug.remote_enable=on
xdebug.remote_port=9000
xdebug.idekey=PHPSTORM
xdebug.remote_autostart=on
xdebug.remote_connect_back=on
在开始调试会话之前,我使用
创建一个SSH隧道ssh -nNT -R 9000:localhost:9000 joerg@sa-platform.dev-vm
在PhpStorm中,我使用SFTP
配置了部署,并将PHP CLI解释器设置为远程php cli版本。
我激活"开始侦听PHP调试连接"。第一次建立连接时,创建了服务器调试连接,并添加了项目根目录的映射:
在我的本地计算机上,IP 192.168.56.57
已映射到sa-platform.dev-vm
中的/etc/hosts
个域。
当我在VM bin/console sa:events:group
上调用我的命令时,我在PhpStorm中获得连接,停在相关控制台脚本的第一行。
我可以调试,直到调用我的命令的执行函数:
但之后没有机会调试我的命令。
我已经尝试将PhpStorm中的PHP服务器映射直接设置为命令文件,但是没有用。
任何帮助表示感谢。
更新 建议我添加日志文件并在PhpStorm中将accept外部调试连接设置为5。
我对日志一无所知,但也许有人在做什么?
<- context_get -i 23 -d 0 -c 1
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="context_get" transaction_id="23" context="1"><property name="$_COOKIE" fullname="$_COOKIE" type="array" children="0" numchildren="0" page="0" pagesize="100"></property><property name="$_ENV" fullname="$_ENV" type="array" children="0" numchildren="0" page="0" pagesize="100"></property><property name="$_FILES" fullname="$_FILES" type="array" children="0" numchildren="0" page="0" pagesize="100"></property><property name="$_GET" fullname="$_GET" type="array" children="0" numchildren="0" page="0" pagesize="100"></property><property name="$_POST" fullname="$_POST" type="array" children="0" numchildren="0" page="0" pagesize="100"></property><property name="$_REQUEST" fullname="$_REQUEST" type="array" children="0" numchildren="0" page="0" pagesize="100"></property><property name="$_SERVER" fullname="$_SERVER" type="array" children="1" numchildren="27" page="0" pagesize="100"><property name="COMP_WORDBREAKS" fullname="$_SERVER['COMP_WORDBREAKS']" type="string" size="12" encoding="base64"><![CDATA[IAkKIic+PDt8Jig6]]></property><property name="TERM" fullname="$_SERVER['TERM']" type="string" size="14" encoding="base64"><![CDATA[eHRlcm0tMjU2Y29sb3I=]]></property><property name="SHELL" fullname="$_SERVER['SHELL']" type="string" size="9" encoding="base64"><![CDATA[L2Jpbi9iYXNo]]></property><property name="SSH_CLIENT" fullname="$_SERVER['SSH_CLIENT']" type="string" size="21" encoding="base64"><![CDATA[MTkyLjE2OC41Ni4xIDUxODQ2IDIy]]></property><property name="OLDPWD" fullname="$_SERVER['OLDPWD']" type="string" size="11" encoding="base64"><![CDATA[L2hvbWUvam9lcmc=]]></property><property name="SSH_TTY" fullname="$_SERVER['SSH_TTY']" type="string" size="10" encoding="base64"><![CDATA[L2Rldi9wdHMvMA==]]></property><property name="USER" fullname="$_SERVER['USER']" type="string" size="5" encoding="base64"><![CDATA[am9lcmc=]]></property><property name="LS_COLORS" fullname="$_SERVER['LS_COLORS']" type="string" size="1422" encoding="base64"><![CDATA[cnM9MDpkaT0wMTszNDpsbj0wMTszNjptaD0wMDpwaT00MDszMzpzbz0wMTszNTpkbz0wMTszNTpiZD00MDszMzswMTpjZD00MDszMzswMTpvcj00MDszMTswMTpzdT0zNzs0MTpzZz0zMDs0MzpjYT0zMDs0MTp0dz0zMDs0Mjpvdz0zNDs0MjpzdD0zNzs0NDpleD0wMTszMjoqLnRhcj0wMTszMToqLnRnej0wMTszMToqLmFyYz0wMTszMToqLmFyaj0wMTszMToqLnRhej0wMTszMToqLmxoYT0wMTszMToqLmx6ND0wMTszMToqLmx6aD0wMTszMToqLmx6bWE9MDE7MzE6Ki50bHo9MDE7MzE6Ki50eHo9MDE7MzE6Ki50em89MDE7MzE6Ki50N3o9MDE7MzE6Ki56aXA9MDE7MzE6Ki56PTAxOzMxOiouWj0wMTszMToqLmR6PTAxOzMxOiouZ3o9MDE7MzE6Ki5scno9MDE7MzE6Ki5sej0wMTszMToqLmx6bz0wMTszMToqLnh6PTAxOzMxOiouYnoyPTAxOzMxOiouYno9MDE7MzE6Ki50Yno9MDE7MzE6Ki50YnoyPTAxOzMxOioudHo9MDE7MzE6Ki5kZWI9MDE7MzE6Ki5ycG09MDE7MzE6Ki5qYXI9MDE7MzE6Ki53YXI9MDE7MzE6Ki5lYXI9MDE7MzE6Ki5zYXI9MDE7MzE6Ki5yYXI9MDE7MzE6Ki5hbHo9MDE7MzE6Ki5hY2U9MDE7MzE6Ki56b289MDE7MzE6Ki5jcGlvPTAxOzMxOiouN3o9MDE7MzE6Ki5yej0wMTszMToqLmNhYj0wMTszMToqLmpwZz0wMTszNToqLmpwZWc9MDE7MzU6Ki5naWY9MDE7MzU6Ki5ibXA9MDE7MzU6Ki5wYm09MDE7MzU6Ki5wZ209MDE7MzU6Ki5wcG09MDE7MzU6Ki50Z2E9MDE7MzU6Ki54Ym09MDE7MzU6Ki54cG09MDE7MzU6Ki50aWY9MDE7MzU6Ki50aWZmPTAxOzM1OioucG5nPTAxOzM1Oiouc3ZnPTAxOzM1Oiouc3Znej0wMTszNToqLm1uZz0wMTszNToqLnBjeD0wMTszNToqLm1vdj0wMTszNToqLm1wZz0wMTszNToqLm1wZWc9MDE7MzU6Ki5tMnY9MDE7MzU6Ki5ta3Y9MDE7MzU6Ki53ZWJtPTAxOzM1Oioub2dtPTAxOzM1OioubXA0PTAxOzM1OioubTR2PTAxOzM1OioubXA0dj0wMTszNToqLnZvYj0wMTszNToqLnF0PTAxOzM1OioubnV2PTAxOzM1Oioud212PTAxOzM1OiouYXNmPTAxOw==]]></property><property name="MAIL" fullname="$_SERVER['MAIL']" type="string" size="15" encoding="base64"><![CDATA[L3Zhci9tYWlsL2pvZXJn]]></property><property name="PATH" fullname="$_SERVER['PATH']" type="string" size="56" encoding="base64"><![CDATA[L3Vzci9sb2NhbC9iaW46L3Vzci9iaW46L2JpbjovdXNyL2xvY2FsL2dhbWVzOi91c3IvZ2FtZXM=]]></property><property name="PWD" fullname="$_SERVER['PWD']" type="string" size="20" encoding="base64"><![CDATA[L3Zhci93d3cvc2EtcGxhdGZvcm0=]]></property><property name="LANG" fullname="$_SERVER['LANG']" type="string" size="11" encoding="base64"><![CDATA[ZGVfREUuVVRGLTg=]]></property><property name="GCC_COLORS" fullname="$_SERVER['GCC_COLORS']" type="string" size="66" encoding="base64"><![CDATA[ZXJyb3I9MDE7MzE6d2FybmluZz0wMTszNTpub3RlPTAxOzM2OmNhcmV0PTAxOzMyOmxvY3VzPTAxOnF1b3RlPTAx]]></property><property name="SHLVL" fullname="$_SERVER['SHLVL']" type="string" size="1" encoding="base64"><![CDATA[MQ==]]></property><property name="HOME" fullname="$_SERVER['HOME']" type="string" size="11" encoding="base64"><![CDATA[L2hvbWUvam9lcmc=]]></property><property name="LOGNAME" fullname="$_SERVER['LOGNAME']" type="string" size="5" encoding="base64"><![CDATA[am9lcmc=]]></property><property name="SSH_CONNECTION" fullname="$_SERVER['SSH_CONNECTION']" type="string" size="35" encoding="base64"><![CDATA[MTkyLjE2OC41Ni4xIDUxODQ2IDE5Mi4xNjguNTYuNTcgMjI=]]></property><property name="_" fullname="$_SERVER['_']" type="string" size="11" encoding="base64"><![CDATA[YmluL2NvbnNvbGU=]]></property><property name="PHP_SELF" fullname="$_SERVER['PHP_SELF']" type="string" size="11" encoding="base64"><![CDATA[YmluL2NvbnNvbGU=]]></property><property name="SCRIPT_NAME" fullname="$_SERVER['SCRIPT_NAME']" type="string" size="11" encoding="base64"><![CDATA[YmluL2NvbnNvbGU=]]></property><property name="SCRIPT_FILENAME" fullname="$_SERVER['SCRIPT_FILENAME']" type="string" size="11" encoding="base64"><![CDATA[YmluL2NvbnNvbGU=]]></property><property name="PATH_TRANSLATED" fullname="$_SERVER['PATH_TRANSLATED']" type="string" size="11" encoding="base64"><![CDATA[YmluL2NvbnNvbGU=]]></property><property name="DOCUMENT_ROOT" fullname="$_SERVER['DOCUMENT_ROOT']" type="string" size="0" encoding="base64"><![CDATA[]]></property><property name="REQUEST_TIME_FLOAT" fullname="$_SERVER['REQUEST_TIME_FLOAT']" type="float"><![CDATA[1496314052.1787]]></property><property name="REQUEST_TIME" fullname="$_SERVER['REQUEST_TIME']" type="int"><![CDATA[1496314052]]></property><property name="argv" fullname="$_SERVER['argv']" type="array" children="1" numchildren="2"></property><property name="argc" fullname="$_SERVER['argc']" type="int"><![CDATA[2]]></property></property><property name="$GLOBALS" fullname="$GLOBALS" type="array" children="1" numchildren="17" page="0" pagesize="100"><property name="_GET" fullname="$GLOBALS['_GET']" type="array" children="0" numchildren="0"></property><property name="_POST" fullname="$GLOBALS['_POST']" type="array" children="0" numchildren="0"></property><property name="_COOKIE" fullname="$GLOBALS['_COOKIE']" type="array" children="0" numchildren="0"></property><property name="_FILES" fullname="$GLOBALS['_FILES']" type="array" children="0" numchildren="0"></property><property name="argv" fullname="$GLOBALS['argv']" type="array" children="1" numchildren="2"></property><property name="argc" fullname="$GLOBALS['argc']" type="int"><![CDATA[2]]></property><property name="_ENV" fullname="$GLOBALS['_ENV']" type="array" children="0" numchildren="0"></property><property name="_REQUEST" fullname="$GLOBALS['_REQUEST']" type="array" children="0" numchildren="0"></property><property name="_SERVER" fullname="$GLOBALS['_SERVER']" type="array" children="1" numchildren="27"></property><property name="GLOBALS" fullname="$GLOBALS['GLOBALS']" type="array" children="1" recursive="1"></property><property name="__composer_autoload_files" fullname="$GLOBALS['__composer_autoload_files']" type="array" children="1" numchildren="9"></property><property name="loader" fullname="$GLOBALS['loader']" type="object" classname="Composer\Autoload\ClassLoader" children="1" numchildren="9"></property><property name="input" fullname="$GLOBALS['input']" type="object" classname="Symfony\Component\Console\Input\ArgvInput" children="1" numchildren="6"></property><property name="env" fullname="$GLOBALS['env']" type="string" size="3" encoding="base64"><![CDATA[ZGV2]]></property><property name="debug" fullname="$GLOBALS['debug']" type="bool"><![CDATA[1]]></property><property name="kernel" fullname="$GLOBALS['kernel']" type="object" classname="AppKernel" children="1" numchildren="10"></property><property name="application" fullname="$GLOBALS['application']" type="object" classname="Symfony\Bundle\FrameworkBundle\Console\Application" children="1" numchildren="14"></property></property></response>
<- context_get -i 24 -d 0 -c 2
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="context_get" transaction_id="24" context="2"><property name="RANDOM_COMPAT_READ_BUFFER" fullname="RANDOM_COMPAT_READ_BUFFER" type="int" facet="constant"><![CDATA[8]]></property></response>
<- run -i 25
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="run" transaction_id="25" status="stopping" reason="ok"></response>
<- run -i 26
Log closed at 2017-06-01 10:48:01
答案 0 :(得分:0)
事实证明,我尝试调试的SaEventsGroupCommand
的本地版本与VM上的版本不同。检查映射并尝试@LazyOne的所有建议后,我从本地计算机部署到VM以获取命令包。之后它很有用并且调试器按照预期在我的断点处突破。
如果有人遇到类似的问题那么结论。确保已将所有代码手动部署到远程服务器,或者将自动部署设置为将外部更改(例如,不同的git分支)部署到服务器。