Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

My Xdebug is not working. Why isn't break points not working?

I have installed Xdebug with VS Code and Flywheel local and I am learning how to make themes. I have put a breakpoint in my index.php file. However, the said breakpoint is not working.

I am not getting any errors in my console. Nothing is happening in VS Code debug terminal when I load my site. It's just all blank. I have also installed PHP Debug extension in VS Code.

However, when I type in debug console anything I get this message - Cannot evaluate code without a connection.

What went wrong here?

My php.ini

[xdebug]
{{#if os.windows}}
zend_extension = php_xdebug.dll
{{else}}
zend_extension = {{extensions.xdebug}}
{{/if}}

xdebug.remote_enable=1
xdebug.remote_connect_back=Off
xdebug.remote_port="9000"
xdebug.profiler_enable=0
xdebug.remote_autostart = 1
xdebug.mode=debug

My launch.json

{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        


        {
            "name": "Listen for XDebug",
            "type": "php",
            "request": "launch",
            "port": 9000,
            "pathMappings": {
                "C:/Users/ajayb/Local Sites/wordpress-theme-1/app/public": "${workspaceRoot}"
            }
        },
        {
            "name": "Launch currently open script",
            "type": "php",
            "request": "launch",
            "program": "${file}",
            "cwd": "${fileDirname}",
            "port": 9000
        }
    ]
}
like image 652
killerprince182 Avatar asked Oct 18 '25 11:10

killerprince182


2 Answers

I have faced the same problem. Local by FlyWheel installs Xdebug 2.7 for PHP 7.3 and XDebug 3.x when using PHP 7.4. If you are using PHP 7.4 modify the php.ini file and replace the xdebug section with the following:

[Xdebug]

; Consider checking php_xdebug.dll file properties to get installed Xdebug version
zend_extension="D:\Programs\xammp\php\ext\php_xdebug.dll"

; Settings for Xdebug 2.x
xdebug.scream = 1
xdebug.remote_enable = 1
xdebug.show_local_vars = 1
xdebug.remote_autostart = 1
xdebug.remote_connect_back = 1

; Settings for Xdebug 3.x
xdebug.mode = debug
xdebug.start_with_request = yes
xdebug.client_port="9000" ; Default now is 9003
like image 72
Dakshinamurthy Karra Avatar answered Oct 21 '25 01:10

Dakshinamurthy Karra


Even if you have XDebug's version 2.x.x, the default configuration is not enough.

You have to use the following for Xdebug v2.x.x:

xdebug.remote_enable = 1
xdebug.remote_autostart = 1
xdebug.remote_port = 9000
like image 28
Mooze Avatar answered Oct 21 '25 01:10

Mooze



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!