[英]Is There a way to debug RabbitMQ Consumer (php-ampqlib) using PhpStorm and Xdebug?
[英]Debug php executed from rabbitmq queue with xdebug
我正在嘗試調試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文件的權限,並且通過CLI執行某些操作時, XDEBUG_CONFIG
變量可以正常工作。
從隊列執行代碼時為什么忽略XDEBUG_CONFIG
任何想法?
為了使您的IDE知道連接,您需要在命令前加上環境變量:
XDEBUG_CONFIG="put-here-your-value" php my-script.php
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.