使用xdebug从rabbitmq队列执行调试php

问题描述 投票:1回答:1

我正在尝试调试RabbitMQ使用者执行的PHP代码。

xdebug在CLI和http中工作正常,但是当从队列执行某些操作时它会失败。我设置了以下跟踪:

ini_get("xdebug.idekey")  
ini_get("xdebug.remote_host")
ini_get("xdebug.remote_connect_back")  
ini_get("xdebug.remote_mode"). 
ini_get("xdebug.remote_autostart") 
php_ini_loaded_file()
getenv("XDEBUG_CONFIG")

它打印:

"" 
localhost
1
req
0

/etc/php5/cli/php.ini    

xdebug.idekey=sublime.xdebug 
xdebug.remote_host=10.5.223.108 
xdebug.remote_connect_back=0 
xdebug.remote_mode=req xdebug.remote_autostart=1 

所以问题似乎是它忽略了环境变量XDEBUG_CONFIG并且正在使用cli ini文件中的值。我没有权限修改ini文件,并且XDEBUG_CONFIG变量在通过CLI执行某些操作时工作正常。

当从队列执行代码时,为什么XDEBUG_CONFIG被忽略的任何想法?

php rabbitmq xdebug
1个回答
0
投票

Xdebug and RabbitMQ consumer commands

要使IDE了解连接,您需要在命令前添加环境变量:

XDEBUG_CONFIG="put-here-your-value" php my-script.php

© www.soinside.com 2019 - 2024. All rights reserved.