# xDebug + VSCode - breakpoints not hit when debugging

**URL:** <https://community.localwp.com/t/xdebug-vscode-breakpoints-not-hit-when-debugging/26652>\
**Category:** Xdebug + VS Code\
**Created:** [July 20, 2021, 5:21am UTC](https://community.localwp.com/t/xdebug-vscode-breakpoints-not-hit-when-debugging/26652 "2021-07-20T05:21:26Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![localuser](https://sea1.discourse-cdn.com/flex019/user_avatar/community.localwp.com/localuser/32/13668_2.png) [@localuser](https://community.localwp.com/u/localuser)\
**Post date:** [July 20, 2021, 5:21am UTC](https://community.localwp.com/t/xdebug-vscode-breakpoints-not-hit-when-debugging/26652/1 "2021-07-20T05:21:26Z")

</div>

Hi,

I have installed Local and can get my wordpress site to work, but cannot get the breakpoints to hit when debugging in VSCode.

I followed the steps to setup debugging:  
[https://localwp.com/community/t/localbyflywheel-xdebug-vscode/11950/9](https://localwp.com/community/t/localbyflywheel-xdebug-vscode/11950/9)

> SETUP

> 1. Install the add-on
> 2. Enable the add-on & Relaunch Local
> 3. Go to the site you want to debug in Local
> 4. Start the site
> 5. Click on the Utilities tab
> 6. Click the “Add Run Configuration to VS Code” link - this will create an xdebug/vscode configuration file inside the app/public folder

> Debugging

> 1. Open the app/public folder in vscode
> 2. Start debugging (command/control + shift + p and then type “debug” then click “Debug: Start Debugging”
> 3. Load the site in your browser

I then open my index.php file in VSCode and set several breakpoints. I refresh the site in the browser, but my breakpoints are not hit.

Here is my launch.json  
{

```
"version": "0.2.0",

"configurations": [

    {

        "name": "Listen for Xdebug (Local)",

        "type": "php",

        "request": "launch",

        "port": 9000,

        "xdebugSettings": {

            "max_children": 128,

            "max_data": 1024,

            "max_depth": 3,

            "show_hidden": 1

        }

    },

    {

        "name": "Launch currently open script",

        "type": "php",

        "request": "launch",

        "program": "${file}",

        "cwd": "${fileDirname}",

        "port": 9000,

        "xdebugSettings": {

            "max_children": 128,

            "max_data": 1024,

            "max_depth": 3,

            "show_hidden": 1

        }

    }

]

```

}

When I start my website in Local, the url that appears in my browser is:  
[http://localhost:10005](http://localhost:10005)

I have tried altering the port in my launch.json to 10005, but it has no affect.

Any help would be much appreciated.

---

<div class="post-metadata">

**Author:** ![ben.turner](https://sea1.discourse-cdn.com/flex019/user_avatar/community.localwp.com/ben.turner/32/5366_2.png) [@ben.turner](https://community.localwp.com/u/ben.turner)\
**Post date:** [July 26, 2021, 8:31pm UTC](https://community.localwp.com/t/xdebug-vscode-breakpoints-not-hit-when-debugging/26652/2 "2021-07-26T20:31:32Z")

</div>

> [@localuser](#):
>
> I then open my index.php file in VSCode and set several breakpoints.

Which `index.php` file are you accessing? You might try setting a breakpoint within the `wp-config.php` file since sometimes the `index.php` file of a WP project isn’t run.

---

<div class="post-metadata">

**Author:** ![localuser](https://sea1.discourse-cdn.com/flex019/user_avatar/community.localwp.com/localuser/32/13668_2.png) [@localuser](https://community.localwp.com/u/localuser)\
**Post date:** [July 27, 2021, 2:59am UTC](https://community.localwp.com/t/xdebug-vscode-breakpoints-not-hit-when-debugging/26652/3 "2021-07-27T02:59:38Z")

</div>

Hi Ben,

Thanks for the help. I had added this line to my index.php

> echo ‘this shows we have made it here’;

and put the breakpoint on that line. I can see the text is output on my site, so I know the line is being executed. Unfortunately, the breakpoint was not hit.

Also also tried your suggestion & put the breakpoint at wp-config.php but it was not hit there either.

---

<div class="post-metadata">

**Author:** ![afragen](https://sea1.discourse-cdn.com/flex019/user_avatar/community.localwp.com/afragen/32/31_2.png) [@afragen](https://community.localwp.com/u/afragen)\
**Post date:** [July 27, 2021, 3:58am UTC](https://community.localwp.com/t/xdebug-vscode-breakpoints-not-hit-when-debugging/26652/4 "2021-07-27T03:58:55Z")

</div>

Out of curiosity what version of PHP are you using on the site in question?

---

<div class="post-metadata">

**Author:** ![localuser](https://sea1.discourse-cdn.com/flex019/user_avatar/community.localwp.com/localuser/32/13668_2.png) [@localuser](https://community.localwp.com/u/localuser)\
**Post date:** [July 27, 2021, 4:53am UTC](https://community.localwp.com/t/xdebug-vscode-breakpoints-not-hit-when-debugging/26652/5 "2021-07-27T04:53:08Z")

</div>

I actually got this working. I am not sure what version of XDebug is shipped with Local, so I added these lines to my php.ini.hbs

> xdebug.mode = debug  
> xdebug.start\_with\_request = yes  
> xdebug.remote\_enable = 1  
> xdebug.remote\_autostart = 1  
> xdebug.remote\_port = 9003

I then changed the port in my launch.json from 9000 to 9003

---

<div class="post-metadata">

**Author:** ![afragen](https://sea1.discourse-cdn.com/flex019/user_avatar/community.localwp.com/afragen/32/31_2.png) [@afragen](https://community.localwp.com/u/afragen)\
**Post date:** [July 28, 2021, 2:48am UTC](https://community.localwp.com/t/xdebug-vscode-breakpoints-not-hit-when-debugging/26652/6 "2021-07-28T02:48:44Z")

</div>

PHP 8 includes xDebug 3.0 which requires the port change to 9003

> **[Install PHP 8](https://community.localwp.com/t/install-php-8/22673/8)**
>
> Also xdebug.start\_with\_request=trigger is more appropriate as running the step debugger even when it is not activated in the IDE will generate warnings. In summary, what seems to work consistently is if I change the php.ini.hbs file inside of...

---

<div class="post-metadata">

**Author:** ![system](https://sea1.discourse-cdn.com/flex019/user_avatar/community.localwp.com/system/32/1_2.png) [@system](https://community.localwp.com/u/system)\
**Post date:** [August 6, 2021, 5:16pm UTC](https://community.localwp.com/t/xdebug-vscode-breakpoints-not-hit-when-debugging/26652/7 "2021-08-06T17:16:27Z")

</div>

This topic was automatically closed 36 hours after the last reply. New replies are no longer allowed.
