martomo / SublimeTextXdebug

Xdebug debugger client for Sublime Text
MIT License
565 stars 89 forks source link

Breakpoints are skipped while debugging PHP application with Sublime Text 3 #200

Open vineethgk opened 5 years ago

vineethgk commented 5 years ago

Hi,

I have been trying to debug a PHP application on LAMPP stack from Sublime Text 3, but the browser loads the page completely without hitting any of the breakpoints I have set in them. I am running the LAMPP stack on Ubuntu 18.04 with PHP version 7.3.8 and Xdebug version 2.7.2 (installed based on the instructions from the wizard.).

Since the same Xdebug setup happen to work perfectly with VS Code, I tried comparing the Xdebug logs generated for both.

As can be seen from the log for Sublime Text run at the bottom, Xdebug recognizes the breakpoints correctly, but there is an error while communicating with the client using IPv6 address of localhost (::1). On the other hand, in the case of VS Code, the IPv6 address seems to be handled without error and the debugger works correctly.

I tried swapping the host address between 'localhost', '172.0.0.1' and '192.168.1.215' (private IP of the machine in LAN) in php.ini, .sublime_project, and Xdebug.sublime-settings files, but there was no change. The debugger in VS Code works perfectly with Xdebug regardless of these changes, so I'm guessing the issue lies on the side of Sublime Text (when it tries to communicate with Xdebug) instead of any problem with the Xdebug installation.

For the past couple of days I have been experimenting with various fixes suggested in different forums, but I'm no closer to a solution yet.

Can you please shed some light on this? I have pasted the contents of the configuration files and the logs below.

Environment

Sublime Text

Operating system: Ubuntu 18.04 Installed version/build: Sublime Text 3 v3.2.1 Python version: 3.3.6

Server

LAMPP stack running on Ubuntu 18.04 PHP/Xdebug version: PHP 7.3.8 / Xdebug 2.7.2

Configuration

php.ini/xdebug.ini

zend_extension=/opt/lampp/lib/php/extensions/no-debug-non-zts-20180731/xdebug.so

[XDebug]

xdebug.remote_enable=1

xdebug.remote_autostart=true

xdebug.remote_host=192.168.1.215

xdebug.remote_connect_back=1 ; Not safe for production servers

xdebug.remote_port=9000

xdebug.remote_handler=dbgp

xdebug.remote_mode=req

xdebug.remote_log=/tmp/xdebug.log

xdebug.idekey=sublime.xdebug

Packages/User/Xdebug.sublime-settings

{

"path_mapping": {

"/opt/lampp/htdocs/" : "/opt/lampp/htdocs/"

},

"url": "http://192.168.1.215/index.php",

"ide_key": "sublime.xdebug",

"host": "192.168.1.215",

"port": 9000,

"max_children": 32,

"max_data": 1024,

"max_depth": 1,

"break_on_start": false,

"break_on_exception": [
    "Fatal error",
    "Catchable fatal error",
    "Warning",
    "Parse error",
    "Notice",
    "Strict standards",
    "Deprecated",
    "Xdebug",
    "Unknown error"
],

"close_on_stop": false,

"super_globals": true,

"fullname_property": true,

"hide_password": false,

"pretty_output": false,

"launch_browser": false,

"browser_no_execute": false,

"disable_layout": false,

"debug_layout" : {
    "cols": [0.0, 0.5, 1.0],
    "rows": [0.0, 0.7, 1.0],
    "cells": [[0, 0, 2, 1], [0, 1, 1, 2], [1, 1, 2, 2]]
},

"breakpoint_group": 2,
"breakpoint_index": 1,
"context_group": 1,
"context_index": 0,
"stack_group": 2,
"stack_index": 0,
"watch_group": 1,
"watch_index": 1,

"breakpoint_enabled": "circle",
"breakpoint_disabled": "dot",
"breakpoint_current": "",
"current_line": "bookmark",

"python_path" : "",

"debug": true

} *.sublime-project

{

"folders":

[

    {

        "follow_symlinks": true,

        "path": "."

    }

],

"settings": {

    "xdebug": {

         "url": "http://192.168.1.215/fastusvisa/",

         "path_mapping": {

            "/opt/lampp/htdocs/<application>" : "/opt/lampp/htdocs/<application>",

            "super_globals": true,

            "close_on_stop": true

        },

    }

}

}

Logs

Console output:

Packages/User/Xdebug.log:

Xdebug.log (successful) from VS Code

[3156] Log opened at 2019-09-23 09:15:01 [3156] I: Checking remote connect back address. [3156] I: Checking header 'HTTP_X_FORWARDED_FOR'. [3156] I: Checking header 'REMOTEADDR'. [3156] I: Remote address found, connecting to 192.168.1.215:9000. [3156] I: Connected to client. :-)_ [3156] -> <![CDATA[Xdebug]]><![CDATA[Derick Rethans]]><![CDATA[https://xdebug.org]]><![CDATA[Copyright (c) 2002-2019 by Derick Rethans]]> [3156] <- breakpoint_list -i 1 [3156] -> [3156] <- breakpoint_list -i 2 [3156] -> [3156] <- breakpoint_set -i 3 -t line -f file:///opt/lampp/htdocs/fastusvisa/wp-content/themes/di-business/footer.php -n 16 [3156] -> [3156] <- breakpoint_set -i 4 -t line -f file:///opt/lampp/htdocs/fastusvisa/wp-content/themes/di-business/header.php -n 15 [3156] -> [3156] <- breakpoint_list -i 5 [3156] -> [3156] <- breakpoint_list -i 6 [3156] -> [3156] <- breakpoint_set -i 7 -t exception -x [3156] -> [3156] <- run -i 8 [3156] -> [3156] <- stop -i 9 [3156] -> [3156] Log closed at 2019-09-23 09:15:02 [3955] Log opened at 2019-09-23 09:15:02 [3955] I: Checking remote connect back address. [3955] I: Checking header 'HTTP_X_FORWARDED_FOR'. [3955] I: Checking header 'REMOTEADDR'. [3955] I: Remote address found, connecting to ::1:9000. [3955] I: Connected to client. :-)_ [3955] -> <![CDATA[Xdebug]]><![CDATA[Derick Rethans]]><![CDATA[https://xdebug.org]]><![CDATA[Copyright (c) 2002-2019 by Derick Rethans]]> [3955] <- breakpoint_list -i 1 [3955] -> [3955] <- breakpoint_list -i 2 [3955] -> [3955] <- breakpoint_set -i 3 -t line -f file:///opt/lampp/htdocs/fastusvisa/wp-content/themes/di-business/footer.php -n 16 [3955] -> [3955] [3955] <- breakpoint_set -i 4 -t line -f file:///opt/lampp/htdocs/fastusvisa/wp-content/themes/di-business/header.php -n 15 [3955] -> [3955] [3955] <- breakpoint_list -i 5 [3955] -> [3955] [3955] <- breakpoint_list -i 6 [3955] -> [3955] [3955] <- breakpoint_set -i 7 -t exception -x [3955] -> [3955] [3955] <- run -i 8 . . . . [3955] <- step_over -i 32 [3955] -> </xdebug:message> [3955] <- stack_get -i 33 [3955] -> [3955] <- run -i 34 [3955] -> [3955] <- stop -i 35 [3955] -> [3955] Log closed at 2019-09-23 09:15:24 [3955] `

Xdebug.log (failure) from Sublime Text 3

[3152] Log opened at 2019-09-23 09:07:08 [3152] I: Checking remote connect back address. [3152] I: Checking header 'HTTP_X_FORWARDED_FOR'. [3152] I: Checking header 'REMOTEADDR'. **[3152] I: Remote address found, connecting to 192.168.1.215:9000. [3152] I: Connected to client. :-)_ [3152] -> <![CDATA[Xdebug]]><![CDATA[Derick Rethans]]><![CDATA[https://xdebug.org]]><![CDATA[Copyright (c) 2002-2019 by Derick Rethans]]> [3152] <- feature_set -i 1 -n show_hidden -v 1 [3152] -> [3152] <- feature_set -i 2 -n max_children -v 32 [3152] -> [3152] <- feature_set -i 3 -n max_data -v 1024 [3152] -> [3152] <- feature_set -i 4 -n max_depth -v 1 [3152] -> [3152] <- breakpoint_set -i 5 -f file%3A///opt/lampp/htdocs/fastusvisa/wp-content/themes/di-business/header.php -t line -n 15 [3152] -> [3152] <- breakpoint_set -i 6 -f file%3A///opt/lampp/htdocs/fastusvisa/wp-content/themes/di-business/header.php -t line -n 32 [3152] -> [3152] <- breakpoint_set -i 7 -f file%3A///opt/lampp/htdocs/fastusvisa/wp-content/themes/di-business/header.php -t line -n 5 [3152] -> [3152] <- breakpoint_set -i 8 -f file%3A///opt/lampp/htdocs/fastusvisa/wp-content/themes/di-business/header.php -t line -n 23 [3152] -> [3152] <- breakpoint_set -i 9 -t exception -x "Fatal error" [3152] -> [3152] <- breakpoint_set -i 10 -t exception -x "Catchable fatal error" [3152] -> [3152] <- breakpoint_set -i 11 -t exception -x "Warning" [3152] -> [3152] <- breakpoint_set -i 12 -t exception -x "Parse error" [3152] -> [3152] <- breakpoint_set -i 13 -t exception -x "Notice" [3152] -> [3152] <- breakpoint_set -i 14 -t exception -x "Strict standards" [3152] -> [3152] <- breakpoint_set -i 15 -t exception -x "Deprecated" [3152] -> [3152] <- breakpoint_set -i 16 -t exception -x "Xdebug" [3152] -> [3152] <- breakpoint_set -i 17 -t exception -x "Unknown error" [3152] -> [3152] <- run -i 18 [3152] -> [3152] Log closed at 2019-09-23 09:07:15 [3153] Log opened at 2019-09-23 09:07:15 [3153] I: Checking remote connect back address. [3153] I: Checking header 'HTTP_X_FORWARDED_FOR'. [3153] I: Checking header 'REMOTE_ADDR'. [3153] I: Remote address found, connecting to ::1:9000. [3153] W: Creating socket for '::1:9000', poll success, but error: Operation now in progress (29). [3153] E: Could not connect to client. :-( [3153] Log closed at 2019-09-23 09:07:15 [3153] Log opened at 2019-09-23 09:07:17 [3153] I: Checking remote connect back address. [3153] I: Checking header 'HTTP_X_FORWARDED_FOR'. [3153] I: Checking header 'REMOTEADDR'. [3153] I: Remote address found, connecting to ::1:9000. [3153] W: Creating socket for '::1:9000', poll success, but error: Operation now in progress (29). [3153] E: Could not connect to client. :-(_ [3153] Log closed at 2019-09-23 09:07:17 [3153] Log opened at 2019-09-23 09:07:17 [3153] I: Checking remote connect back address. [3153] I: Checking header 'HTTP_X_FORWARDED_FOR'. [3153] I: Checking header 'REMOTEADDR'. [3153] I: Remote address found, connecting to ::1:9000. [3153] W: Creating socket for '::1:9000', poll success, but error: Operation now in progress (29). [3153] E: Could not connect to client. :-(_ [3153] Log closed at 2019-09-23 09:07:17 [3153] Log opened at 2019-09-23 09:07:17 [3153] I: Checking remote connect back address. [3153] I: Checking header 'HTTP_X_FORWARDED_FOR'. [3153] I: Checking header 'REMOTEADDR'. [3153] I: Remote address found, connecting to ::1:9000. [3153] W: Creating socket for '::1:9000', poll success, but error: Operation now in progress (29). [3153] E: Could not connect to client. :-(**_ [3153] Log closed at 2019-09-23 09:07:17 [3153]

lewsid commented 4 years ago

I am experiencing the exact same issue. Everything works in Visual Studio Code, but error after error when using Sublime Text 3 and this plugin. I've tried everything, no dice.

meengit commented 4 years ago

@lewsid, I switched from this Package to the Debugger Package. If you have experience in using VS Code and Xdebug the Debugger Package is – in my opinion – easy to handle.

lewsid commented 4 years ago

Thanks @meengit!

vickris commented 4 years ago

@vineethgk Did you find a solution? I have the same issue as well