# Xdebug stopped working with Visual Studio

**URL:** https://community.kinsta.com/t/xdebug-stopped-working-with-visual-studio/2393
**Category:** Application Support
**Created:** [July 28, 2023, 6:10pm UTC](https://community.kinsta.com/t/xdebug-stopped-working-with-visual-studio/2393 "2023-07-28T18:10:05Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![mikesreilley](https://sea2.discourse-cdn.com/flex020/user_avatar/community.kinsta.com/mikesreilley/32/2252_2.png) [@mikesreilley](https://community.kinsta.com/u/mikesreilley)
#### Post date: [July 28, 2023, 6:10pm UTC](https://community.kinsta.com/t/xdebug-stopped-working-with-visual-studio/2393/1 "2023-07-28T18:10:05Z")

</div>

I have been trying to figure out what’s going wrong for hours now and finally broke down to ask for help. Prior to yesterday, I have been using Xdebug with Visual Studio Code with no problems at all. I’d add a breakpoint, and when I would run Postman to call a custom endpoint, VSC would break, at which point I could step through the code.

At some point yesterday, breakpoints just stopped working. I have checked the “ENABLE XDEBUG” toggle, and it’s on. I checked the PHP.ini settings in wrench screen, and they look correct, which I’ll post below. I have looked through what I believe is the main post about Xdebug issues dating back to 2021 before there was integrated support for Xdebug in DevKinsta, Checked the VSC launch file many times, I’ve updated Xdebug with the Xdebug installation wizard, googled all sorts of Xdebug related topics, and nothing has helped. At this point, debugging is silent in VSC.

All of the functionality related to the endpoint is working as it should. It’s just that the Xdebug functionality stopped without me knowing why.

Any help with this issue would be much appreciated, but I’m a bit stuck here until I can get debugging functional again.

 ![CleanShot 2023-07-28 at 14.22.57@2x](https://us1.discourse-cdn.com/flex020/uploads/kinsta/original/2X/6/69054aa21132dc69de0c0012723e2521100f1092.png)

---

<div class="post-metadata">

### Author: ![mikesreilley](https://sea2.discourse-cdn.com/flex020/user_avatar/community.kinsta.com/mikesreilley/32/2252_2.png) [@mikesreilley](https://community.kinsta.com/u/mikesreilley)
#### Post date: [July 28, 2023, 10:03pm UTC](https://community.kinsta.com/t/xdebug-stopped-working-with-visual-studio/2393/2 "2023-07-28T22:03:59Z")

</div>

Kept working on this today and was finally able to get it working again. However, I want to understand this more in case something goes wrong in the future. The issue was that my port in the “xdebug.client\_port” in PHP.ini was set to 9003, which I believe is the default setting. However, even if I change my Visual Studio Code laungh.json port to 9003, Xdebug does not respond. If I change it back to 9000 in the launch.json file, then change the “xdebug.client\_port” to “9000” in the DevKinsta wrench tab, then everything works.

I don’t understand this, because I would have thought the ports would only have to match. Does anyone have any ideas why port 9003 is not working? Is that port taken up by another app running on my Mac? I haven’t looked into that in any depth, but if that’s possible, does anyone know of a good tool for finding out what ports are in use in macOS?

 ![CleanShot 2023-07-28 at 17.58.46@2x](https://us1.discourse-cdn.com/flex020/uploads/kinsta/original/2X/f/f7f4f453670a2fed8bdab4ca8258a1ed2c415de7.png)

---

<div class="post-metadata">

### Author: ![ZachE](https://sea2.discourse-cdn.com/flex020/user_avatar/community.kinsta.com/zache/32/1683_2.png) [@ZachE](https://community.kinsta.com/u/ZachE)
#### Post date: [July 28, 2023, 11:03pm UTC](https://community.kinsta.com/t/xdebug-stopped-working-with-visual-studio/2393/3 "2023-07-28T23:03:07Z")

</div>

Hi @mikesreilley 👋

Can you post the output (or screenshot) of the following command in Terminal.app ?

`sudo lsof -i -Pnl | grep LISTEN`

This will prompt for your user password (which won’t appear while you type it, but if you type it and press Return, it should execute the command)

Best regards,  
Zach

---

<div class="post-metadata">

### Author: ![mikesreilley](https://sea2.discourse-cdn.com/flex020/user_avatar/community.kinsta.com/mikesreilley/32/2252_2.png) [@mikesreilley](https://community.kinsta.com/u/mikesreilley)
#### Post date: [July 31, 2023, 7:46pm UTC](https://community.kinsta.com/t/xdebug-stopped-working-with-visual-studio/2393/4 "2023-07-31T19:46:04Z")

</div>

Thank you ZachE,  
Here’s a screenshot after running the command you posted. From what I can tell, there’s no other processes listening to port 9003.

 ![CleanShot 2023-07-31 at 15.45.08](https://us1.discourse-cdn.com/flex020/uploads/kinsta/original/2X/9/9ed9d558594cb053179f884f05bf49d721c94d4b.png)

---

<div class="post-metadata">

### Author: ![ZachE](https://sea2.discourse-cdn.com/flex020/user_avatar/community.kinsta.com/zache/32/1683_2.png) [@ZachE](https://community.kinsta.com/u/ZachE)
#### Post date: [July 31, 2023, 11:37pm UTC](https://community.kinsta.com/t/xdebug-stopped-working-with-visual-studio/2393/5 "2023-07-31T23:37:36Z")

</div>

So it looks like maybe the lsof didn’t reveal it because it’s running on a docker internal address/namespace, so you might have to find it from within the context of the devkinsta\_fpm container shell:

`docker exec devkinsta_fpm -c "lsof \| grep :900"`

Could you try adjusting the PHP xdebug configuration:

```auto
xdebug.mode=develop,debug
xdebug.client_host=host.docker.internal

```

Source: [Xdebug Support: PHP debugging - #30 by nemanjac](https://community.kinsta.com/t/xdebug-support-php-debugging/71/30)

If that doesn’t work, try these solutions instead, thinking it’s an xdebug options issue at play here:

> [@Xdebug Support: PHP debugging](https://community.kinsta.com/t/xdebug-support-php-debugging/71/56):
>
> Hi @sonicviz and @jscotti, I agree that from a PHP development standpoint this is an important feature. I’m assuming when the Roadmap was finalized, basic web design needs were prioritized based on our surveys, interviews and forum engagement. I have notified our developers about this issue and spent a good deal of time figuring out how to get this work. Hopefully this works for everyone: I based my setup on @sonicviz 's [findings](https://community.kinsta.com/t/xdebug-support-php-debugging/71/35) and [this post](https://dev.to/jackmiras/xdebug-in-vscode-with-docker-379l). For some reason, using host.docker.internal no lon…

> [@Xdebug Support: PHP debugging](https://community.kinsta.com/t/xdebug-support-php-debugging/71/70):
>
> Here’s how I got it working. From the wrench/site configurations option in DevKinsta I made sure “enable xdebug” was checked. In the PHP.ini editor I had the following lines: xdebug.remote\_autostart=1 xdebug.remote\_enable=1 xdebug.profiler\_enable=1 xdebug.profiler\_enable\_trigger = 1 xdebug.discover\_client\_host = 1 You can verify this with a phpinfo(); output, but the config on my system was still using the classic port 9000, not the 9003 XDebug 3 supposedly moved to. I have the PHP Debugv…

---

<div class="post-metadata">

### Author: ![mikesreilley](https://sea2.discourse-cdn.com/flex020/user_avatar/community.kinsta.com/mikesreilley/32/2252_2.png) [@mikesreilley](https://community.kinsta.com/u/mikesreilley)
#### Post date: [August 1, 2023, 5:27pm UTC](https://community.kinsta.com/t/xdebug-stopped-working-with-visual-studio/2393/6 "2023-08-01T17:27:37Z")

</div>

Thank you again for your help with this ZackE. I’m going to leave this alone for now, because everything is working now with the port set to 9000 in both the PHP.ini and the VS Code launch.json file. While I would like to understand more, as always, it’s one of those thing I’ll have to gain knowledge incrementally, probably when something stops working again =) I’ve made a good leap here and hopefully it will keep me going for a good while into the future.

Take care, and thanks again!
