Я установил Xdebug в гостевой системе Ubuntu 14.04 Vagrant и настроил его для работы с SublimeText3 в моей хост-системе OSX. Я следовал инструкциям Вот.
Кажется, все работает, но когда я запускаю Xdebug, точка останова не желтеет, и неясно, какая точка в коде включена, хотя я вижу контекстную панель.
Когда я проверяю журналы xDebug, я вижу, что он подключается к клиенту, а затем говорит, что не может подключиться к клиенту.
Log opened at 2016-03-31 08:08:59
I: Connecting to configured address/port: 10.0.2.2:9000.
I: Connected to client. :-)
-> <init xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" fileuri="file:///vagrant/httpdocs/project-2/index.php" language="PHP" xdebug:language_version="5.5.9-1ubuntu4.14" protocol_version="1.0" appid="2256" idekey="XDEBUG_ECLIPSE"><engine version="2.4.0"><![CDATA[Xdebug]]></engine><author><![CDATA[Derick Rethans]]></author><url><![CDATA[http://xdebug.org]]></url><copyright><![CDATA[Copyright (c) 2002-2016 by Derick Rethans]]></copyright></init>
<- feature_set -i 1 -v 1 -n show_hidden
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="feature_set" transaction_id="1" feature="show_hidden" success="1"></response>
<- feature_set -i 2 -v 32 -n max_children
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="feature_set" transaction_id="2" feature="max_children" success="1"></response>
<- feature_set -i 3 -v 1024 -n max_data
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="feature_set" transaction_id="3" feature="max_data" success="1"></response>
<- feature_set -i 4 -v 1 -n max_depth
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="feature_set" transaction_id="4" feature="max_depth" success="1"></response>
<- breakpoint_set -i 5 -n 40 -f file%3A///var/www/project-2/index.php -t line
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="breakpoint_set" transaction_id="5" id="22560001"></response>
<- breakpoint_set -i 6 -n 20 -f file%3A///Users/holy/ubuntu_1404/httpdocs/project-1/app/design/frontend/hoi/default/template/page/html/header.phtml -t line
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="breakpoint_set" transaction_id="6" id="22560002"></response>
<- breakpoint_set -i 7 -x "Fatal error" -t exception
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="breakpoint_set" transaction_id="7" id="22560003"></response>
<- breakpoint_set -i 8 -x "Catchable fatal error" -t exception
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="breakpoint_set" transaction_id="8" id="22560004"></response>
<- breakpoint_set -i 9 -x "Warning" -t exception
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="breakpoint_set" transaction_id="9" id="22560005"></response>
<- breakpoint_set -i 10 -x "Parse error" -t exception
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="breakpoint_set" transaction_id="10" id="22560006"></response>
<- breakpoint_set -i 11 -x "Notice" -t exception
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="breakpoint_set" transaction_id="11" id="22560007"></response>
<- breakpoint_set -i 12 -x "Strict standards" -t exception
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="breakpoint_set" transaction_id="12" id="22560008"></response>
<- breakpoint_set -i 13 -x "Deprecated" -t exception
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="breakpoint_set" transaction_id="13" id="22560009"></response>
<- breakpoint_set -i 14 -x "Xdebug" -t exception
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="breakpoint_set" transaction_id="14" id="22560010"></response>
<- breakpoint_set -i 15 -x "Unknown error" -t exception
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="breakpoint_set" transaction_id="15" id="22560011"></response>
<- run -i 16
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="run" transaction_id="16" status="break" reason="ok"><xdebug:message filename="file:///vagrant/httpdocs/project-2/index.php" lineno="40"></xdebug:message></response>
<- context_get -i 17 -c 1
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="context_get" transaction_id="17" context="1"><property name="$_COOKIE" fullname="$_COOKIE" type="array" children="1" numchildren="3" page="0" pagesize="32"><property name="__zlcmid" fullname="$_COOKIE['__zlcmid']" type="string" size="14" encoding="base64"><![CDATA[WnBmUVZIclEzSWtiQmU=]]></property><property name="PHPSESSID" fullname="$_COOKIE['PHPSESSID']" type="string" size="26" encoding="base64"><![CDATA[YWplcjAyaGh1bjVya2djZXBiaDc2cjFhbTU=]]></property><property name="XDEBUG_SESSION" fullname="$_COOKIE['XDEBUG_SESSION']" type="string" size="14" encoding="base64"><![CDATA[WERFQlVHX0VDTElQU0U=]]></property></property><property name="$_ENV" fullname="$_ENV" type="array" children="0" numchildren="0" page="0" pagesize="32"></property><property name="$_FILES" fullname="$_FILES" type="array" children="0" numchildren="0" page="0" pagesize="32"></property><property name="$_GET" fullname="$_GET" type="array" children="0" numchildren="0" page="0" pagesize="32"></property><property name="$_POST" fullname="$_POST" type="array" children="0" numchildren="0" page="0" pagesize="32"></property><property name="$_REQUEST" fullname="$_REQUEST" type="array" children="0" numchildren="0" page="0" pagesize="32"></property><property name="$_SERVER" fullname="$_SERVER" type="array" children="1" numchildren="35" page="0" pagesize="32"><property name="SCRIPT_URL" fullname="$_SERVER['SCRIPT_URL']" type="string" size="1" encoding="base64"><![CDATA[Lw==]]></property><property name="SCRIPT_URI" fullname="$_SERVER['SCRIPT_URI']" type="string" size="29" encoding="base64"><![CDATA[aHR0cDovL2Rldi5kaWV0LWV4cGVydC5sb2NhbC8=]]></property><property name="HTTP_AUTHORIZATION" fullname="$_SERVER['HTTP_AUTHORIZATION']" type="string" size="0" encoding="base64"><![CDATA[]]></property><property name="HTTP_HOST" fullname="$_SERVER['HTTP_HOST']" type="string" size="21" encoding="base64"><![CDATA[ZGV2LmRpZXQtZXhwZXJ0LmxvY2Fs]]></property><property name="HTTP_CONNECTION" fullname="$_SERVER['HTTP_CONNECTION']" type="string" size="10" encoding="base64"><![CDATA[a2VlcC1hbGl2ZQ==]]></property><property name="HTTP_CACHE_CONTROL" fullname="$_SERVER['HTTP_CACHE_CONTROL']" type="string" size="9" encoding="base64"><![CDATA[bWF4LWFnZT0w]]></property><property name="HTTP_ACCEPT" fullname="$_SERVER['HTTP_ACCEPT']" type="string" size="74" encoding="base64"><![CDATA[dGV4dC9odG1sLGFwcGxpY2F0aW9uL3hodG1sK3htbCxhcHBsaWNhdGlvbi94bWw7cT0wLjksaW1hZ2Uvd2VicCwqLyo7cT0wLjg=]]></property><property name="HTTP_UPGRADE_INSECURE_REQUESTS" fullname="$_SERVER['HTTP_UPGRADE_INSECURE_REQUESTS']" type="string" size="1" encoding="base64"><![CDATA[MQ==]]></property><property name="HTTP_USER_AGENT" fullname="$_SERVER['HTTP_USER_AGENT']" type="string" size="120" encoding="base64"><![CDATA[TW96aWxsYS81LjAgKE1hY2ludG9zaDsgSW50ZWwgTWFjIE9TIFggMTBfMTFfMikgQXBwbGVXZWJLaXQvNTM3LjM2IChLSFRNTCwgbGlrZSBHZWNrbykgQ2hyb21lLzQ5LjAuMjYyMy44NyBTYWZhcmkvNTM3LjM2]]></property><property name="HTTP_ACCEPT_ENCODING" fullname="$_SERVER['HTTP_ACCEPT_ENCODING']" type="string" size="19" encoding="base64"><![CDATA[Z3ppcCwgZGVmbGF0ZSwgc2RjaA==]]></property><property name="HTTP_ACCEPT_LANGUAGE" fullname="$_SERVER['HTTP_ACCEPT_LANGUAGE']" type="string" size="32" encoding="base64"><![CDATA[ZW4tVVMsZW47cT0wLjgsc3Y7cT0wLjYsZXM7cT0wLjQ=]]></property><property name="HTTP_COOKIE" fullname="$_SERVER['HTTP_COOKIE']" type="string" size="92" encoding="base64"><![CDATA[X196bGNtaWQ9WnBmUVZIclEzSWtiQmU7IFBIUFNFU1NJRD1hamVyMDJoaHVuNXJrZ2NlcGJoNzZyMWFtNTsgWERFQlVHX1NFU1NJT049WERFQlVHX0VDTElQU0U=]]></property><property name="PATH" fullname="$_SERVER['PATH']" type="string" size="60" encoding="base64"><![CDATA[L3Vzci9sb2NhbC9zYmluOi91c3IvbG9jYWwvYmluOi91c3Ivc2JpbjovdXNyL2Jpbjovc2JpbjovYmlu]]></property><property name="SERVER_SIGNATURE" fullname="$_SERVER['SERVER_SIGNATURE']" type="string" size="81" encoding="base64"><![CDATA[PGFkZHJlc3M+QXBhY2hlLzIuNC43IChVYnVudHUpIFNlcnZlciBhdCBkZXYuZGlldC1leHBlcnQubG9jYWwgUG9ydCA4MDwvYWRkcmVzcz4K]]></property><property name="SERVER_SOFTWARE" fullname="$_SERVER['SERVER_SOFTWARE']" type="string" size="21" encoding="base64"><![CDATA[QXBhY2hlLzIuNC43IChVYnVudHUp]]></property><property name="SERVER_NAME" fullname="$_SERVER['SERVER_NAME']" type="string" size="21" encoding="base64"><![CDATA[ZGV2LmRpZXQtZXhwZXJ0LmxvY2Fs]]></property><property name="SERVER_ADDR" fullname="$_SERVER['SERVER_ADDR']" type="string" size="13" encoding="base64"><![CDATA[MTkyLjE2OC45OS45OQ==]]></property><property name="SERVER_PORT" fullname="$_SERVER['SERVER_PORT']" type="string" size="2" encoding="base64"><![CDATA[ODA=]]></property><property name="REMOTE_ADDR" fullname="$_SERVER['REMOTE_ADDR']" type="string" size="12" encoding="base64"><![CDATA[MTkyLjE2OC45OS4x]]></property><property name="DOCUMENT_ROOT" fullname="$_SERVER['DOCUMENT_ROOT']" type="string" size="20" encoding="base64"><![CDATA[L3Zhci93d3cvZGlldGF2ZW51ZS8=]]></property><property name="REQUEST_SCHEME" fullname="$_SERVER['REQUEST_SCHEME']" type="string" size="4" encoding="base64"><![CDATA[aHR0cA==]]></property><property name="CONTEXT_PREFIX" fullname="$_SERVER['CONTEXT_PREFIX']" type="string" size="0" encoding="base64"><![CDATA[]]></property><property name="CONTEXT_DOCUMENT_ROOT" fullname="$_SERVER['CONTEXT_DOCUMENT_ROOT']" type="string" size="20" encoding="base64"><![CDATA[L3Zhci93d3cvZGlldGF2ZW51ZS8=]]></property><property name="SERVER_ADMIN" fullname="$_SERVER['SERVER_ADMIN']" type="string" size="23" encoding="base64"><![CDATA[Y29udGFjdEBkaWV0LWV4cGVydC5jb20=]]></property><property name="SCRIPT_FILENAME" fullname="$_SERVER['SCRIPT_FILENAME']" type="string" size="29" encoding="base64"><![CDATA[L3Zhci93d3cvZGlldGF2ZW51ZS9pbmRleC5waHA=]]></property><property name="REMOTE_PORT" fullname="$_SERVER['REMOTE_PORT']" type="string" size="5" encoding="base64"><![CDATA[NDk0MzY=]]></property><property name="GATEWAY_INTERFACE" fullname="$_SERVER['GATEWAY_INTERFACE']" type="string" size="7" encoding="base64"><![CDATA[Q0dJLzEuMQ==]]></property><property name="SERVER_PROTOCOL" fullname="$_SERVER['SERVER_PROTOCOL']" type="string" size="8" encoding="base64"><![CDATA[SFRUUC8xLjE=]]></property><property name="REQUEST_METHOD" fullname="$_SERVER['REQUEST_METHOD']" type="string" size="3" encoding="base64"><![CDATA[R0VU]]></property><property name="QUERY_STRING" fullname="$_SERVER['QUERY_STRING']" type="string" size="0" encoding="base64"><![CDATA[]]></property><property name="REQUEST_URI" fullname="$_SERVER['REQUEST_URI']" type="string" size="1" encoding="base64"><![CDATA[Lw==]]></property><property name="SCRIPT_NAME" fullname="$_SERVER['SCRIPT_NAME']" type="string" size="10" encoding="base64"><![CDATA[L2luZGV4LnBocA==]]></property></property></response>
<- context_get -i 18
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="context_get" transaction_id="18" context="0"><property name="$compilerConfig" fullname="$compilerConfig" type="uninitialized"></property><property name="$mageFilename" fullname="$mageFilename" type="uninitialized"></property><property name="$mageRunCode" fullname="$mageRunCode" type="uninitialized"></property><property name="$mageRunType" fullname="$mageRunType" type="uninitialized"></property><property name="$maintenanceFile" fullname="$maintenanceFile" type="uninitialized"></property></response>
<- stack_get -i 19
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="stack_get" transaction_id="19"><stack where="{main}" level="0" type="file" filename="file:///vagrant/httpdocs/project-2/index.php" lineno="40"></stack></response>
Log opened at 2016-03-31 08:09:06
I: Connecting to configured address/port: 10.0.2.2:9000.
E: Could not connect to client. :-(
Log closed at 2016-03-31 08:09:06
Log opened at 2016-03-31 08:09:06
I: Connecting to configured address/port: 10.0.2.2:9000.
E: Could not connect to client. :-(
Log closed at 2016-03-31 08:09:06
Log opened at 2016-03-31 08:09:06
I: Connecting to configured address/port: 10.0.2.2:9000.
E: Could not connect to client. :-(
Log closed at 2016-03-31 08:09:06
Я использую 10.0.2.2 в качестве удаленного хоста в файле php.ini.
xdebug.remote_host=10.0.2.2
Я просто взял эту настройку из учебника, и она, кажется, работает, сначала я попробовал 10.0.2.15, так как это был IP-адрес, который я вижу, когда я бродю ssh
IP address for eth0: 10.0.2.15
А также с ifconfig
vagrant@dev:/var/log/xdebug$ ifconfig
eth0 Link encap:Ethernet HWaddr 08:00:27:c9:24:d6
inet addr:10.0.2.15 Bcast:10.0.2.255 Mask:255.255.255.0
inet6 addr: fe80::a00:27ff:fec9:24d6/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:1297 errors:0 dropped:0 overruns:0 frame:0
TX packets:1004 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:118158 (118.1 KB) TX bytes:157804 (157.8 KB)
eth1 Link encap:Ethernet HWaddr 08:00:27:f4:70:ac
inet addr:192.168.99.99 Bcast:192.168.99.255 Mask:255.255.255.0
inet6 addr: fe80::a00:27ff:fef4:70ac/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:1024 errors:0 dropped:0 overruns:0 frame:0
TX packets:1263 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:142856 (142.8 KB) TX bytes:1993376 (1.9 MB)
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:104 errors:0 dropped:0 overruns:0 frame:0
TX packets:104 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:8804 (8.8 KB) TX bytes:8804 (8.8 KB)
Но xDebug вообще не подключается, когда я использую 10.0.2.15 в качестве удаленного хоста.
/etc/php5/apache2/php.ini
zend_extension="/usr/lib/php5/20121212/xdebug.so"xdebug.default_enable = 1
xdebug.idekey = "vagrant"xdebug.remote_enable = 1
xdebug.remote_autostart = 0
xdebug.remote_port = 9000
xdebug.remote_handler=dbgp
xdebug.remote_log="/var/log/xdebug/xdebug.log"xdebug.remote_host= 10.0.2.2 ; IDE-Environments IP, from vagrant box
project.sublime-проект
{
"folders":
[
{
"path": "/Users/holy/ubuntu_1404/httpdocs/project"}
],
"settings": {
"xdebug": {
"path_mapping": {
"/var/www/project" : "/Users/holy/ubuntu_1404/httpdocs/project",
},
"url": "http://dev.project.local/",
"super_globals": true,
"close_on_stop": true
}
}
}
После попытки предложить ответ от @MarcinOrlowski он, кажется, работает из журналов, но в Sublime точка останова все еще не желтеет, и я не могу видеть, какая точка в коде Xdebug включена в sublime.
Log opened at 2016-03-31 08:48:15
I: Checking remote connect back address.
I: Checking header 'HTTP_X_FORWARDED_FOR'.
I: Checking header 'REMOTE_ADDR'.
I: Remote address found, connecting to 192.168.99.1:9000.
I: Connected to client. :-)
-> <init xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" fileuri="file:///vagrant/httpdocs/project/index.php" language="PHP" xdebug:language_version="5.5.9-1ubuntu4.14" protocol_version="1.0" appid="2626" idekey="XDEBUG_ECLIPSE"><engine version="2.4.0"><![CDATA[Xdebug]]></engine><author><![CDATA[Derick Rethans]]></author><url><![CDATA[http://xdebug.org]]></url><copyright><![CDATA[Copyright (c) 2002-2016 by Derick Rethans]]></copyright></init>
<- feature_set -i 1 -v 1 -n show_hidden
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="feature_set" transaction_id="1" feature="show_hidden" success="1"></response>
Еще некоторые подробности на удаленном хосте …
vagrant@dev:~$ route | grep default | awk '{print $2}'
10.0.2.2
vagrant@dev:~$ telnet 10.0.2.2 9000
Trying 10.0.2.2...
telnet: Unable to connect to remote host: Connection refused
vagrant@dev:~$ tcpdump port 9000
tcpdump: no suitable device found
Я бы удалил remote_host
запись но добавить remote_connect_back
вместо (документы):
Если этот параметр включен, параметр xdebug.remote_host игнорируется, и Xdebug
попробуйте подключиться к клиенту, который сделал HTTP-запрос.
Так что это должно сработать (и вам может понадобиться сначала перезапустить httpd на vagrant)
xdebug.remote_handler="dbgp"xdebug.remote_port=9000
xdebug.remote_autostart = on
xdebug.remote_start = on
xdebug.remote_enable = on
xdebug.remote_connect_back = on
xdebug.idekey = "vagrant"
КСТАТИ: zend_extension
путь может быть относительным, если вы получили extension_dir установить правильно.
zend_extension=xdebug.so
Других решений пока нет …