I have a problem trying to debug using xdebug, DBGp and Notepad++ as it never hits my breakpoints. I have done a lot of searching and cannot see where I am going wrong:
I have configured with the correct ports and when looking at my xdebug.log I can see that it seems to be happy:
Log opened at 2013-04-22 12:10:58
I: Connecting to configured address/port: 127.0.0.1:8080.
I: Connected to client. :-)
-> <init xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" fileuri="file:///C:/Program%20Files%20%28x86%29/resources/appliance/download_agents.php" language="PHP" protocol_version="1.0" appid="2740" idekey="xdebug"><engine version="2.2.2"><![CDATA[Xdebug]]></engine><author><![CDATA[Derick Rethans]]></author><url><![CDATA[http://xdebug.org]]></url><copyright><![CDATA[Copyright (c) 2002-2013 by Derick Rethans]]></copyright></init>
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" status="stopping" reason="ok"></response>
Log closed at 2013-04-22 12:10:58
Log opened at 2013-04-22 12:11:19
I: Connecting to configured address/port: 127.0.0.1:8080.
I: Connected to client. :-)
-> <init xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" fileuri="file:///C:/Program%20Files%20%28x86%29/resources/appliance/download_agents.php" language="PHP" protocol_version="1.0" appid="2740" idekey="xdebug"><engine version="2.2.2"><![CDATA[Xdebug]]></engine><author><![CDATA[Derick Rethans]]></author><url><![CDATA[http://xdebug.org]]></url><copyright><![CDATA[Copyright (c) 2002-2013 by Derick Rethans]]></copyright></init>
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" status="stopping" reason="ok"></response>
Log closed at 2013-04-22 12:11:19
However it never seems to hit the breakpoints.
I have set DBG breakpoint in file download_agents.php and I enter the URL:
http://localhost:8080/download_agents.php?XDEBUG_SESSION_START=xdebug
but it never hits it. Refresh causes a new entry to be added to above mentioned log file so seems to connect. However the GUI for DBG within Notepad++ doesn't have a connected message on it.
My php.ini file entries are as follows:
[xdebug]
zend_extension="C:\nginx\php\ext\php_xdebug-2.2.2-5.3-vc9.dll"
xdebug.remote_enable=1
xdebug.remote_handler=dbgp
xdebug.remote_host=127.0.0.1
xdebug.remote_port=8080
xdebug.remote_mode=req
xdebug.idekey=default
xdebug.remote_log="c:\tmp\xdebug\xdebug.log"
xdebug.show_exception_trace=0
xdebug.show_local_vars=9
xdebug.show_mem_delta=0
xdebug.trace_format=0
xdebug.profiler_enable = 1
xdebug.profiler_output_dir ="c:\tmp\xdebug"
and the DBG config looks as follows:
Both the Remote Path and Local Path point to the root of my web app and match that of the output in the xdebug.log file:
file:///C:/Program%20Files%20%28x86%29/resources/appliance/download_agents.php"
Please any assistance would be greatly received..
Thanks
2 Applications: One is your server, the other was xdebug (until you set back to dafault). What you have to tell is, where you get that error-message or better how's throwing this message. If it's Notepad++ you may try an update / a clean install of Npp (just to be sure). Maybe, you can start DBGp in verbose-mode. Another try could be using filemon, hoping you find npp reading a xml.
Related
I am running PhpStorm on one machine and I am running php-fpm on another. I have a ssh tunnel between them.
I have a proofs of the following statements:
ssh tunnel is configured correctly and works (I am using nc and nc -l to test it).
xdebug is configured correctly and works (I am using nc -l to receive it's connections and also I can use another IDE (vscode) successfully)
phpstorm is receiving incoming connections
My site has constantly refreshing page and on my tunnel console I see constant messages
connect_to localhost port 9001: failed
Which proves, that xdebug is trying to connect to IDE on each refresh but failing.
Then I am pressing
Start listening for PHP Debug Connections button and these messages disappear.
This means that ssh was now able to connect to IDE.
But the problem is nothing else happens. No any breakpoint triggers, no any dialog appears to provide mappings, nothing.
What else can be checked to fix this?
Php version is: 5.6.33-0+deb8u1
Xdebug version is: 2.2.5
Phpstorm version is: 2020.3
The following appears in xdebug log:
Log opened at 2020-12-22 12:14:17
I: Connecting to configured address/port: 127.0.0.1:9001.
I: Connected to client. :-)
-> <init xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" fileuri="file:///settings/html/load_menu.php" language="PHP" protocol_version="1.0" appid="13307" idekey="1"><engine version="2.2.5"><![CDATA[Xdebug]]></engine><author><![CDATA[Derick Rethans]]></author><url><![CDATA[http://xdebug.org]]></url><copyright><![CDATA[Copyright (c) 2002-2014 by Derick Rethans]]></copyright></init>
<!**************** MY REMARK ********************!>
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" status="stopping" reason="ok"></response>
Log closed at 2020-12-22 12:14:17
Note my remark place. If I receive connections with nc -l 9001 it waits in this place until I drop connection with Ctrl-C.
If I receive connection with PhpStorm or if I don't receive it, it passes this place immediately.
This means that phpstorm receives incoming connection and the drops it immediately. Why?
If I receive connections with vscode, a lot of messages like
<- breakpoint_list -i 1
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="breakpoint_list" transaction_id="1"></response>
appears in my remark place
No mistakes were found in setup. Turns out is was a bug in PhpStorm 2020.3 and switching to Preview build helped instantly. Thanks to #LazyOne :)
I am trying to debug remote PHP scripts using xdebug. When xdebug is enabled for a website, if xdebug is able to make a tcp connection, the PHP script freezes as though waiting for a breakpoint to be executed. The JavaScript portion of the webpage is displayed correctly, just waiting on the PHP code to return data required to complete the page.
This has worked in the past. I can't for the life of me figure out why.
If xdebug is unable to make establish a TCP session with the remote host, all works as expected.
I am using Angular 10 as my development environment and PhpStorm as my IDE.
Environment:
Debian bullseye (testing)
Apache2.4
PHP 7.4.11
mpm_prefork
xdebug.so 2.9.8
I have also tried xdebug.so v2.8.x and v3.0.0 (Beta) to no effect.
Current /etc/php/7.4/mods-available/xdebug.ini:
#set xdebug flags/values
zend_extension=xdebug.so
xdebug.remote_autostart=0
xdebug.remote_enable=1
xdebug.remote_connect_back=0
xdebug.remote_host=MyClientIP
xdebug.remote_port=9099
xdebug.idekey=PHPSTORM
#xdebug logger
xdebug.remote_log = /var/log/xdebug/xdebug.log
While I am using PhpStorm to develop my application, this issue it is not related to my IDE. To illustrate this I downloaded dbgbClient.exe from xdebug.org.
When using the script a session is created between the client and server.
Client output:
dbgpClient.exe -p 9099 -f
Xdebug Simple DBGp client (0.4.1)
Copyright 2019-2020 by Derick Rethans
Waiting for debug server to connect on port 9099.
Connect from 10.130.189.1:39144
DBGp/1.0: Xdebug 2.9.8 — For PHP 7.4.11
Debugging file:///home/init/DEV/MT4/php-services/ClassAPI.php (ID: 70831/PHPSTORM)
1 | feature_get
1 | supports_async: supported > 0
xdebug.log from server:
[70831] Log opened at 2020-10-14 20:59:24
[70831] I: Connecting to configured address/port: myClientIP:9099.
[70830] Log opened at 2020-10-14 20:59:24
[70830] I: Connecting to configured address/port: MyClientIP:9099.
[70831] I: Connected to client. :-)
[70831] -> <init xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" fileuri="file:///home/init/DEV/MT4/php-services/ClassAPI.php" language="PHP" xdebug:language_version="7.4.11" protocol_version="1.0" appid="70831" idekey="PHPSTORM"><engine version="2.9.8"><![CDATA[Xdebug]]></engine><author><![CDATA[Derick Rethans]]></author><url><![CDATA[https://xdebug.org]]></url><copyright><![CDATA[Copyright (c) 2002-2020 by Derick Rethans]]></copyright></init>
[70830] I: Connected to client. :-)
[70830] -> <init xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" fileuri="file:///home/init/DEV/MT4/php-services/ClassAPI.php" language="PHP" xdebug:language_version="7.4.11" protocol_version="1.0" appid="70830" idekey="PHPSTORM"><engine version="2.9.8"><![CDATA[Xdebug]]></engine><author><![CDATA[Derick Rethans]]></author><url><![CDATA[https://xdebug.org]]></url><copyright><![CDATA[Copyright (c) 2002-2020 by Derick Rethans]]></copyright></init>
At this point the beginnings of the web page is created.
If I issue a run command and an extra carriage return or two, the debug session continues and the screen finishes.
Client example:
(cmd) run
2 | run > stopping/ok
(cmd)
Error while handling connection: Error reading length: EOF
Disconnect
Connect from 10.130.189.1:39146
DBGp/1.0: Xdebug 2.9.8 — For PHP 7.4.11
Debugging file:///home/init/DEV/MT4/php-services/ClassAPI.php (ID: 70830/PHPSTORM)
1 | feature_get
1 | supports_async: supported > 0
(cmd) run
2 | run > stopping/ok
(cmd)
Error while handling connection: Error reading length: EOF
Disconnect
xdebug log for the above:
[70831] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="feature_get" transaction_id="1" feature_name="supports_async" supported="1"><![CDATA[0]]></response>
[70831] <- run -i 2
[70831] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="run" transaction_id="2" status="stopping" reason="ok"></response>
[70831] <- run -i 3
[70831] Log closed at 2020-10-14 21:00:32
[70830] <- feature_get -i 1 -n supports_async
[70830] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="feature_get" transaction_id="1" feature_name="supports_async" supported="1"><![CDATA[0]]></response>
[70830] <- run -i 2
[70830] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="run" transaction_id="2" status="stopping" reason="ok"></response>
[70830] <- run -i 3
[70830] Log closed at 2020-10-14 21:00:41
[70829] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="feature_set" transaction_id="4" status="stopping" reason="ok"></response>
[70829] Log closed at 2020-10-14 21:13:17
[70832] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="feature_set" transaction_id="4" status="stopping" reason="ok"></response>
[70832] Log closed at 2020-10-14 21:13:38
Thank you for reading this far. I'm sure someone out there has a solution.
This is the relevant part:
Error while handling connection: Error reading length: EOF
Disconnect
xdebug is not meant to connect to remote (live) sites, to begin with.
And even if stunnel is working, it might still fail to connect back for some reason ...eg.
xdebug.remote_host=EXTERNAL_ROUTER_IP
xdebug.remote_connect_back=1
And the port-forward :9099 to the internal MyClientIP in the router.
Well, it turns out there is something between my development PC connected to my companies network via VPN. I all worked at one time. Thanks to IT tightening the security screws (firewall rules).
Although my PhpStorm would see the PHPSTORM cookie and establish a TCP session on the correct port, the protocol would not continue to completion. I'm guessing there is some type if smart firewall on the network.
The secret was to establish a ssh tunnel between my PC and the linux server like so:
ssh -R 9000:localhost:9000 username_goes_here#hostname_goes_here
I also modified my /etc/php/7.4/mods-available/xdebug.ini as so: (The magic sauce is xdebug.remote_host=127.0.0.1
zend_extension=xdebug.so
xdebug.remote_log=/var/log/xdebug/xdebug.log
xdebug.remote_host=127.0.0.1
xdebug.remote_enable=1
xdebug.idekey=PHPSTORM
Thus the ssh tunnel will connect to port 9000 on the server with local port 9000 on the PC as the other end of the tunnel.
Then all that had to be done is to setup PhpStorm. For that (and where these instructions originated) see here.
Just a note - I only tested a php script access though a web browser. I have not tested a CLI based PHP script, but I'm guessing the answer is much the same.
If you need more information on ssh port forwarding (tunneling) see here.
PROBLEM: I am currently unable to debug php within NetBeans 8.2 RC on Windows 10. NetBeans shows "Waiting for Connection" in lower right and never connects.
Most of the tutorials I found were from several years ago:
Codewall article //2018...newest?
Michael Milette's Tutorial //seemed thorough, but from 2014
NetBeans site // references php 5...yikes!
Rob Prouse's Tutorial //2010
Note some of these have differing instructions for what should go in php.ini
Xdebug stuff
phpinfo() lists Xdebug as running version 2.9.4 with IDE Key: netbeans-xdebug so at least it's recognized.
relevant php.ini [XDebug] info:
...
output_buffering=off
...
[XDebug]
zend_extension = "c:\xampp\php\ext\php_xdebug-2.9.4-7.4-vc15-x86_64.dll"
xdebug.idekey = netbeans-xdebug
xdebug.profiler_append = 0
xdebug.profiler_enable = 0
xdebug.profiler_enable_trigger = 0
xdebug.profiler_output_dir = "c:\xampp\tmp"
;xdebug.profiler_output_name = "cachegrind.out.%t-%s"
xdebug.remote_enable = 1
xdebug.remote_autostart = 0
xdebug.remote_connect_back = 0
xdebug.remote_handler = "dbgp"
xdebug.remote_host = "127.0.0.1"
xdebug.remote_log="c:\xampp\tmp\xdebug.txt"
xdebug.remote_port = 9000
xdebug.show_local_vars = 9
xdebug.trace_output_dir = "c:\xampp\tmp"
; 3600 (1 hour), 36000 = 10h
xdebug.remote_cookie_expire_time = 36000
xdebug info from phpinfo()
'netstat -an' results while netbeans is waiting for connection
Note the two-way connection between 57418 and 9000
xdebug error log
[10112] Log opened at 2020-07-27 15:33:34
[10112] I: Connecting to configured address/port: 127.0.0.1:9000.
[10112] E: Time-out connecting to client (Waited: 200 ms). :-(
[10112] Log closed at 2020-07-27 15:33:34
[10112] Log opened at 2020-07-27 15:33:47
[10112] I: Connecting to configured address/port: 127.0.0.1:9000.
[10112] I: Connected to client. :-)
[10112] -> <init xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" fileuri="file:///C:/xampp/apps/wordpress/htdocs/index.php" language="PHP" xdebug:language_version="7.4.0" protocol_version="1.0" appid="10112" idekey="netbeans-xdebug"><engine version="2.9.4"><![CDATA[Xdebug]]></engine><author><![CDATA[Derick Rethans]]></author><url><![CDATA[https://xdebug.org]]></url><copyright><![CDATA[Copyright (c) 2002-2020 by Derick Rethans]]></copyright></init>
[10112] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" status="stopping" reason="ok"></response>
[10112] Log closed at 2020-07-27 15:33:51
[10112] Log opened at 2020-07-27 15:33:52
[10112] I: Connecting to configured address/port: 127.0.0.1:9000.
[10112] E: Time-out connecting to client (Waited: 200 ms). :-(
[10112] Log closed at 2020-07-27 15:33:52
[10112] Log opened at 2020-07-27 15:34:05
[10112] I: Connecting to configured address/port: 127.0.0.1:9000.
[10112] I: Connected to client. :-)
[10112] -> <init xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" fileuri="file:///C:/xampp/apps/wordpress/htdocs/index.php" language="PHP" xdebug:language_version="7.4.0" protocol_version="1.0" appid="10112" idekey="netbeans-xdebug"><engine version="2.9.4"><![CDATA[Xdebug]]></engine><author><![CDATA[Derick Rethans]]></author><url><![CDATA[https://xdebug.org]]></url><copyright><![CDATA[Copyright (c) 2002-2020 by Derick Rethans]]></copyright></init>
php_xdebug-2.9.4-7.4-vc15-x86_64.dll was the dll recommended by xdebug.org/wizard and is at the expected file location.
NetBeans Configuration
Since I'm attempting to debug a WordPress plugin, I have the entire 'wordpress' directory as my project within NetBeans.
Sources:
Hmm...PHP Version is set to 7.0, and I'm trying to use 7.4...but it says "PHP version is used only for hints". Is this just a simple case of 'NetBeans 8.2 RC doesn't support PHP 7.4'?
Run Configuration:
Any help is appreciated. Thanks in advance.
EDIT: Include xdebug info from phpinfo(), netstat results, and xdebug dump.
Potentially helpful
After changing the behavior to launch the browser again, I noticed that the project wasn't loading with the
"?XDEBUG_SESSION_START=netbeans-xdebug" flag until after I hit stop. This seemed weird to me, but I tried starting the debugger, hitting stop (to launch the website with the flag), and then attaching the debugger. It didn't work (NetBeans spins on 'waiting for connection' and Chrome spins on 'waiting for localhost'). Chrome loads eventually, but the second I try to start navigating to the part of the site to run the php code I'm trying to debug, it goes back to spinning on 'waiting for localhost' with the following xdebug dump (it never navigates away from the home page):
[22340] Log opened at 2020-07-27 15:49:37
[22340] I: Connecting to configured address/port: 127.0.0.1:9000.
[22340] I: Connected to client. :-)
[22340] -> <init xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" fileuri="file:///C:/xampp/apps/wordpress/htdocs/index.php" language="PHP" xdebug:language_version="7.4.0" protocol_version="1.0" appid="22340" idekey="netbeans-xdebug"><engine version="2.9.4"><![CDATA[Xdebug]]></engine><author><![CDATA[Derick Rethans]]></author><url><![CDATA[https://xdebug.org]]></url><copyright><![CDATA[Copyright (c) 2002-2020 by Derick Rethans]]></copyright></init>
For the poor soul trying to get NetBeans working, the answer is...don't use NetBeans. I understand this is a terrible answer, but after 5 hours trying to get it working compared to the 20 minutes getting VSCode working NetBeans just doesn't make sense (unless you have some other reason for using it).
To get VSCode working, I mainly followed this tutorial: https://stackify.com/php-debugging-guide/
Combined with the following php.ini settings:
...
output_buffering=off
...
[XDebug]
zend_extension = "c:\xampp\php\ext\php_xdebug-2.9.4-7.4-vc15-x86_64.dll"
xdebug.remote_enable = 1
xdebug.remote_autostart = 1
Note how fewer settings I actually needed!
I am trying to configure PhpStorm on my local machine and repository is on Amazon EC2. I used SSH tunnelling also but unable to debug using remote debugger.
Here are my configuration files I have placed same configuration in
/etc/php-5.6.d/xdebug.ini
/etc/php.ini
zend_extension=/usr/lib64/php/5.6/modules/xdebug.so
xdebug.remote_enable=1 ; Enable xdebug
xdebug.remote_autostart=Off ; Only start xdebug on demand, not on every request
xdebug.remote_host=127.0.0.1 ; This is unused if the next setting is 'On'
;xdebug.remote_connect_back=On ; Use a special $_SERVER['...'] variable to get the remote address
xdebug.remote_port=9002 ; Port on the IDE to connect back to. Usually it is 9000
xdebug.idekey="phpstorm" ; The IDE key which should match the XDEBUG_SESSION cookie valu
xdebug.remote_connect_back=1
xdebug.remote_log="/tmp/xdebug_remote_log.log"
xdebug.extended_info=1e
I'm creating SSH tunnel using the command given below
ssh -R 9002:localhost:9002 root#18.2xx.2xx.1xx
After turning off remote_connect_back the new logs are here
Log opened at 2018-04-23 15:59:32
I: Connecting to configured address/port: 127.0.0.1:9002.
I: Connected to client. :-)
-> <init xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" fileuri="file:///var/www/immunedata-prod/immunedata/website-php/index.php" language="PHP" xdebug:language_version="5.6.32" protocol_version="1.0" appid="15683" idekey="PHPSTORM"><engine version="2.5.5"><![CDATA[Xdebug]]></engine><author><![CDATA[Derick Rethans]]></author><url><![CDATA[http://xdebug.org]]></url><copyright><![CDATA[Copyright (c) 2002-2017 by Derick Rethans]]></copyright></init>
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" status="stopping" reason="ok"></response>
Log closed at 2018-04-23 15:59:32
How to resolve this issue, I'm not using port 9000 because there's another microservice running at that port.
I've successfully installed Sublime Text and xdebug on my 64bit Win7 machine and installed The easiest Xdebug plugin in Firefox. Sublime Text is running as Administrator, its project file sets the correct path and xdebug settings, and I have breakpoints only on lines with valid PHP code. WampServer is running correctly on http://localhost:8080/.
The xdebug package commands appear to work as designed, but the debugger never stops at my breakpoints. Starting or stopping the debugger within Sublime Text opens the correct HTML page in Firefox, although the page load is significantly slower than usual.
I've set up the xdebug log. Here's a sample.
Log opened at 2013-06-23 21:42:02
I: Connecting to configured address/port: localhost:9000.
I: Connected to client. :-)
-> <init xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" fileuri="file:///C:/wamp/bin/php/firelogger/firelogger.php" language="PHP" protocol_version="1.0" appid="3948" idekey="sublime.xdebug"><engine version="2.2.3"><![CDATA[Xdebug]]></engine><author><![CDATA[Derick Rethans]]></author><url><![CDATA[http://xdebug.org]]></url><copyright><![CDATA[Copyright (c) 2002-2013 by Derick Rethans]]></copyright></init>
<- breakpoint_set -i 1 -n 10 -t line -f file://C:\Users\work\My Projects\ElseApps\EAFF\code\webroot\index.php
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="breakpoint_set" transaction_id="1"><error code="1"><message><![CDATA[parse error in command]]></message></error></response>
<- breakpoint_set -i 2 -n 17 -t line -f file://C:\Users\work\My Projects\ElseApps\EAFF\code\approot\core\etc\eaff-index.php
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="breakpoint_set" transaction_id="2"><error code="1"><message><![CDATA[parse error in command]]></message></error></response>
<- breakpoint_set -i 3 -n 18 -t line -f file://C:\Users\work\My Projects\ElseApps\EAFF\code\approot\core\etc\eaff-index.php
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="breakpoint_set" transaction_id="3"><error code="1"><message><![CDATA[parse error in command]]></message></error></response>
<- run -i 4
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="run" transaction_id="4" status="stopping" reason="ok"></response>
Log closed at 2013-06-23 21:42:04
For completeness, here's the xdebug section of my php.ini file ...
[xdebug]
zend_extension = c:\wamp\bin\php\php5.3.13\ext\php_xdebug-2.2.3-5.3-vc9-x86_64.dll
;xdebug.remote_enable = off
;xdebug.profiler_enable = off
;xdebug.profiler_enable_trigger = off
;xdebug.profiler_output_name = cachegrind.out.%t.%p
;xdebug.profiler_output_dir = "c:/wamp/tmp"
xdebug.remote_enable=1
xdebug.remote_host="localhost"
xdebug.remote_port=9000
xdebug.remote_handler="dbgp"
xdebug.remote_log=C:\wamp\bin\apache\apache2.2.22\logs\xdebug.log
xdebug.remote_mode=req
xdebug.profiler_enable=1
xdebug.profiler_output_dir="c:/wamp/tmp/"
xdebug.collect_params=On
xdebug.show_local_vars=On
... and the Sublime Text project file.
{
"folders":
[
{
"path": "/C/Users/work/My Projects/ElseApps/EAFF/code"
}
],
"settings": {
"xdebug": { "url": "http://localhost:8080" }
}
Sublime Text's status bar shows the following message after I click Start debugging and the page slowly loads:
Xdebug: Page finished executing. Reload to continue debugging.
Can anyone spot where I'm going wrong, or advise a useful path to diagnosing the problem?
The cause does appear to be the space in the path passed to Xdebug by Sublime Text's Xdebug package. The original query ...
<- breakpoint_set -i 3 -n 18 -t line -f file://C:\Users\work\My Projects\ElseApps\EAFF\code\approot\core\etc\eaff-index.php
... results in an error response ...
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="breakpoint_set" transaction_id="3"><error code="1"><message><![CDATA[parse error in command]]></message></error></response>
... but a quick and nasty hack of the Python source file (my first ever Python edit) sends this ...
<- breakpoint_set -i 1 -n 18 -t line -f file://C:\Users\work\MyProj~1\ElseApps\EAFF\code\approot\core\etc\eaff-index.php
... and gets this back ...
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="breakpoint_set" transaction_id="1" id="39480001"></response>
... after which everything works as designed.
The short-term hack used to test this is at line 221 in Xdebug.py:
def uri(self):
rawpath = os.path.realpath(self.view.file_name())
outpath = rawpath.replace("My Projects", "MyProj~1")
# return 'file://' + os.path.realpath(self.view.file_name())
return 'file://' + outpath
I'll investigate further. I'd already deliberately set the 8.3 pathname in the Sublime Text project file, but that's not what's passed to Xdebug. If it were, there should be no problem.
This is a bug in Sublime's implementation of the debugging protocol.
The command being sent:
<- breakpoint_set -i 3 -n 18 -t line -f file://C:\Users\work\My Projects\ElseApps\EAFF\code\approot\core\etc\eaff-index.php
includes spaces in the file name (the value for -f).
It should just use quotes around the path: https://github.com/derickr/xdebug/blob/master/xdebug_handler_dbgp.c#L2289 and https://github.com/derickr/xdebug/blob/master/xdebug_handler_dbgp.c#L2314 …