我一直在按照该链接上的步骤尝试为我的项目在Sublime Text上设置Xdebug
https://www.sitepoint.com/debugging-xdebug-sublime-text-3/
我的项目正在docker上运行,所以这是我的设置
Dockerfile
FROM php:7.3-apache-stretch
RUN pecl install xdebug \
&& docker-php-ext-enable xdebug \
&& a2enmod rewrite
COPY docker/config/php/conf.d/xdebug.ini /usr/local/etc/php/conf.d/xdebug.ini
xdebug.ini文件
[xdebug]
xdebug.default_enable=1
xdebug.remote_autostart=1
xdebug.remote_connect_back=0
xdebug.remote_host=my local ip address here
xdebug.remote_port=9001
xdebug.remote_enable=1
xdebug.remote_log=/tmp/xdebug.log
xdebug.idekey=sublime.xdebug
崇高的项目
{
"folders": [{
"name": "Name of the app",
"path": ".",
"follow_symlinks": true,
}],
"settings": {
"xdebug": {
"path_mapping": {
"/absolute/path/to/server": "/absolute/path/local"
},
"url": "http://localhost",
"port": 9001,
"ide_key": "sublime.xdebug",
"close_on_stop" : true
}
}
}
我还在浏览器扩展(Firefox和Chrome)中都设置了sublime.xdebug,但是当我开始调试并刷新页面时,在加载时可以看到页面“冻结”,但控制台上没有输出崇高的窗户。有什么想法我做错了吗?
这是刷新页面时得到的xdebug.log
[18] Log opened at 2019-05-16 17:54:12
[18] I: Connecting to configured address/port: my-ip-address:9001.
[18] I: Connected to client. :-)
[18] -> <init xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" fileuri="file:///var/www/html/public/index.php" language="PHP" xdebug:language_version="7.3.4" protocol_version="1.0" appid="18" idekey="docker"><engine version="2.7.2"><![CDATA[Xdebug]]></engine><author><![CDATA[Derick Rethans]]></author><url><![CDATA[https://xdebug.org]]></url><copyright><![CDATA[Copyright (c) 2002-2019 by Derick Rethans]]></copyright></init>
[18]
[18] <- feature_set -i 1 -n show_hidden -v 1
[18] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="feature_set" transaction_id="1" feature="show_hidden" success="1"></response>
[18]
[18] <- feature_set -i 2 -n max_children -v 32
[18] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="feature_set" transaction_id="2" feature="max_children" success="1"></response>
[18]
[18] <- feature_set -i 3 -n max_data -v 1024
[18] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="feature_set" transaction_id="3" feature="max_data" success="1"></response>
[18]
[18] <- feature_set -i 4 -n max_depth -v 1
[18] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="feature_set" transaction_id="4" feature="max_depth" success="1"></response>
[18]
[18] <- breakpoint_set -i 5 -t line -f file%3A///var/www/html/public/index.php -n 21
[18] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="breakpoint_set" transaction_id="5" id="180001"></response>
[18]
[18] <- breakpoint_set -i 6 -t exception -x "Fatal error"
[18] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="breakpoint_set" transaction_id="6" id="180002"></response>
[18]
[18] <- breakpoint_set -i 7 -t exception -x "Catchable fatal error"
[18] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="breakpoint_set" transaction_id="7" id="180003"></response>
[18]
[18] <- breakpoint_set -i 8 -t exception -x "Warning"
[18] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="breakpoint_set" transaction_id="8" id="180004"></response>
[18]
[18] <- breakpoint_set -i 9 -t exception -x "Parse error"
[18] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="breakpoint_set" transaction_id="9" id="180005"></response>
[18]
[18] <- breakpoint_set -i 10 -t exception -x "Notice"
[18] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="breakpoint_set" transaction_id="10" id="180006"></response>
[18]
[18] <- breakpoint_set -i 11 -t exception -x "Strict standards"
[18] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="breakpoint_set" transaction_id="11" id="180007"></response>
[18]
[18] <- breakpoint_set -i 12 -t exception -x "Deprecated"
[18] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="breakpoint_set" transaction_id="12" id="180008"></response>
[18]
[18] <- breakpoint_set -i 13 -t exception -x "Xdebug"
[18] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="breakpoint_set" transaction_id="13" id="180009"></response>
[18]
[18] <- breakpoint_set -i 14 -t exception -x "Unknown error"
[18] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="breakpoint_set" transaction_id="14" id="180010"></response>
[18]
[18] <- run -i 15
[18] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="run" transaction_id="15" status="break" reason="ok"><xdebug:message filename="file:///var/www/html/public/index.php" lineno="21"></xdebug:message></response>
[18]
[18] <- context_get -i 16 -c 1
[18] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="context_get" transaction_id="16" context="1">
最后一行(即<response xmlns=urn:debugger_protocol_v1"
)是一个巨大的xml文件,据我所知,该文件包含我所有的ENV变量,并以此结尾
[18] Log closed at 2019-05-16 17:54:28
[18]
[20] Log opened at 2019-05-16 18:00:07
[20] I: Connecting to configured address/port: my-ip-address:9001.
[20] W: Creating socket for 'my-ip-address:9001', poll success, but error: Operation now in progress (29).
[20] E: Could not connect to client. :-(
[20] Log closed at 2019-05-16 18:00:07