Is there a way to troubleshoot why Xdebug not stopping at breakpoints in VSCode?

3.5k views Asked by At

I have been working on why Xdebug is not stopping at breakpoints for days. I have read and tried dozens of solutions on StackOverflow. None of them have worked. Is there a method to troubleshoot why the configuration is not working?. Any help would be greatly appreciated since I have been working on this problem for days.

My setup:

I am using Windows 10, which is loaded on drive C. On my F: drive, I have Laragon (local server), which contains my (PHP v7.2.19) file. My VSCode is also on the F: drive. VSCode uses the extension PHP Debug by Felix Becker.

VSCode Launch.json:

"version": "0.2.0",
"configurations": [
    {
        "name": "Listen for XDebug",
        "type": "php",
        "request": "launch",            
        "port": 9000, 
    },
    {
        "name": "Launch currently open script",
        "type": "php",
        "request": "launch",
        "program": "${file}",
        "cwd": "${fileDirname}",
        "port": 9000
    }
]

I have followed the Xdebug wizard and downloaded & installed everything as instructed. Below is my php.ini file in my Laragon installation.

php.ini

[xdebug]
zend_extension = "F:\Laragon\bin\php\php-7.2.19-Win32-VC15-x64\ext\php_xdebug-3.0.0-7.2-vc15-x86_64.dll"
xdebug.remote_enable = 1
xdebug.remote_autostart = 1

The extension seems to be loaded:

DEBUG     Checking PHPLS_ALLOW_XDEBUG
DEBUG     The xdebug extension is loaded (3.0.0)
DEBUG     Process restarting (PHPLS_ALLOW_XDEBUG=internal|3.0.0|0|*|*)
DEBUG     Running f:\laragon\bin\php\php-7.2.19-Win32-VC15-x64\php.exe -n -c C:\Users\Bill\AppData\Local\Temp\CA11.tmp c:\Users\Bill\.vscode\extensions\felixfbecker.php-intellisense-2.3.14\vendor\felixfbecker\language-server\bin\php-language-server.php --tcp=127.0.0.1:13121 --memory-limit=4095M

DEBUG     Checking PHPLS_ALLOW_XDEBUG
WARNING   Restarted (130 ms). The xdebug extension is loaded (3.0.0)

Is there a way or method to troubleshoot my setup?

3

There are 3 answers

1
Bill On BEST ANSWER

Thank you LazyOne for directing me to the answer in the comments. The problem was, I was using XDebug 2 parameters when I should have been using XDebug 3. Thank you also WebEXP0528 for your posting of a suggested answer. However, the reference to the website really helped me understand why I was changing the php.ini file. The webpage reference xdebug.org/docs/upgrade_guide gave a lot of information that helped me troubleshoot the problem.

Old:

[xdebug]
zend_extension = "F:\Laragon\bin\php\php-7.2.19-Win32-VC15-x64\ext\php_xdebug-3.0.0-7.2-vc15-x86_64.dll"
xdebug.remote_enable = 1
xdebug.remote_autostart = 1

New php.ini based on xdebug.org/docs/upgrade_guide:

[xdebug]
zend_extension = "F:\Laragon\bin\php\php-7.2.19-Win32-VC15-x64\ext\php_xdebug-3.0.0-7.2-vc15-x86_64.dll"
xdebug.mode = debug
xdebug.start_with_request = yes
xdebug.discover_client_host = 1
0
WebEXP0528 On

In php.ini

[xdebug]
zend_extension = "F:\Laragon\bin\php\php-7.2.19-Win32-VC15-x64\ext\php_xdebug-3.0.0-7.2-vc15-x86_64.dll"
xdebug.mode=debug
xdebug.idekey=VSCODE
xdebug.start_with_request=yes
xdebug.client_host=127.0.0.1
xdebug.client_port=9001
0
 AllMight Oj-Link On

Me I use laravel 2.2.2 some version don't work with x debug and i use following line code on my php ini file zend_extension = php_xdebug-2.9.8-7.1-vc14.dll and [XDebug] xdebug.remote_enable = 1 xdebug.remote_autostart = 1