# Xdebug Support: PHP debugging

**URL:** https://community.kinsta.com/t/xdebug-support-php-debugging/71
**Category:** Feature Requests
**Created:** [January 18, 2021, 2:58pm UTC](https://community.kinsta.com/t/xdebug-support-php-debugging/71 "2021-01-18T14:58:26Z")
**Posts on this page:** 9
**Page:** 4

<div class="post-metadata">

### Author: ![jamesgreenblue](https://sea2.discourse-cdn.com/flex020/user_avatar/community.kinsta.com/jamesgreenblue/32/1226_2.png) [@jamesgreenblue](https://community.kinsta.com/u/jamesgreenblue)
#### Post date: [September 10, 2022, 11:06am UTC](https://community.kinsta.com/t/xdebug-support-php-debugging/71/63 "2022-09-10T11:06:51Z")

</div>

Hi @Kevin are we still on track for Q4 to fully support XDebug?

(asking because `ipconfig getifaddr en0` returns an external IP address and I travel a lot for work so this address will keep changing! 🥵 Also probably explains why @Greg36 had to mess with firewall rules as the traffic is crossing interfaces)

---

<div class="post-metadata">

### Author: ![Kevin](https://sea2.discourse-cdn.com/flex020/user_avatar/community.kinsta.com/kevin/32/808_2.png) [@Kevin](https://community.kinsta.com/u/Kevin)
#### Post date: [September 12, 2022, 4:16pm UTC](https://community.kinsta.com/t/xdebug-support-php-debugging/71/64 "2022-09-12T16:16:12Z")

</div>

Hi @jamesgreenblue, I believe xDebug support will be released with the next DK version (within weeks). It will probably need tweaking based on user feedback, though. We’re mainly working to make it easier to set up.

The IP address issue seems to be more due to something changing with Docker. I did originally recommend a way to automatically get the correct IP with a click to our Devs but I’m not sure if that will be in this release.

I’ll post an update in here once the feature is live!

---

<div class="post-metadata">

### Author: ![sonicviz](https://sea2.discourse-cdn.com/flex020/user_avatar/community.kinsta.com/sonicviz/32/391_2.png) [@sonicviz](https://community.kinsta.com/u/sonicviz)
#### Post date: [September 13, 2022, 4:55am UTC](https://community.kinsta.com/t/xdebug-support-php-debugging/71/65 "2022-09-13T04:55:29Z")

</div>

I just switched to WSL2 from HyperV and had to set up XDebug again.  
I followed Kevin’s WSL adapted guide [Xdebug Support: PHP debugging - #56 by Kevin](https://community.kinsta.com/t/xdebug-support-php-debugging/71/56) and it’s working fine (PHP 8.0) for me. Thanks Kevin!

I’m relieved! 😂

PS: You can just use the IP address of the Ethernet vEthernet (WSL) you can see in the task manager.

---

<div class="post-metadata">

### Author: ![Konstantin\_Brazhnik](https://sea2.discourse-cdn.com/flex020/user_avatar/community.kinsta.com/konstantin_brazhnik/32/1571_2.png) [@Konstantin\_Brazhnik](https://community.kinsta.com/u/Konstantin_Brazhnik)
#### Post date: [November 3, 2022, 7:24pm UTC](https://community.kinsta.com/t/xdebug-support-php-debugging/71/66 "2022-11-03T19:24:08Z")

</div>

Hi Kevin,

This post is music to my ears. +1 from me on the need for xDebug to complete the local dev env.

Was this released? I see no mention of xDebug in the latest release line items.

Konstantin

---

<div class="post-metadata">

### Author: ![Kevin](https://sea2.discourse-cdn.com/flex020/user_avatar/community.kinsta.com/kevin/32/808_2.png) [@Kevin](https://community.kinsta.com/u/Kevin)
#### Post date: [November 3, 2022, 7:36pm UTC](https://community.kinsta.com/t/xdebug-support-php-debugging/71/67 "2022-11-03T19:36:59Z")

</div>

Hi @Konstantin_Brazhnik,  
This was about to be released with the current DK version, but I found a huge issue with it and we had to push back the release. We figured it was better to wait/do it right to avoid introducing performance issues.

It’s currently slated for the next release of DevKinsta before the end of the year. I’ll announce if it gets pushed back again, but I’m hopeful for a November/December release.

---

<div class="post-metadata">

### Author: ![Konstantin\_Brazhnik](https://sea2.discourse-cdn.com/flex020/user_avatar/community.kinsta.com/konstantin_brazhnik/32/1571_2.png) [@Konstantin\_Brazhnik](https://community.kinsta.com/u/Konstantin_Brazhnik)
#### Post date: [January 3, 2023, 4:57pm UTC](https://community.kinsta.com/t/xdebug-support-php-debugging/71/69 "2023-01-03T16:57:16Z")

</div>

Kevin,

Happy New Year!

I’m excited to see xDebug in the release logs of the latest version of DevKinsta. Is there any documentation you can point me to about how to use it with VSCode? I’d been using Valet for a while and had no issue configuring PHP and VSCode to work with xDebug, but I’m not 100% sure how this translates to DevKinsta and the docker containers it runs.

Thank you!

Konstantin

---

<div class="post-metadata">

### Author: ![Whitesided](https://sea2.discourse-cdn.com/flex020/user_avatar/community.kinsta.com/whitesided/32/1673_2.png) [@Whitesided](https://community.kinsta.com/u/Whitesided)
#### Post date: [January 18, 2023, 3:29am UTC](https://community.kinsta.com/t/xdebug-support-php-debugging/71/70 "2023-01-18T03:29:44Z")

</div>

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 Debug`v1.30.0` extension installed in VS Code. With that in place you’ll have the ‘Run and debug’ option on the left. Or press Shift-Command-D to open it. Let it create a launch.json file for you.

I removed everything but the “Listen for Xdebug” configuration; it’s not possible to launch a script for remote execution as far as I know so they were just cluttering up the options.

here’s what one of mine looks like, where my workspace is in the wordpress wp-content directory (I don’t want any visibility into the stock WP code or have searches find Automattic’s classes)

```auto
{
    // 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": {
                "/www/kinsta/public/devwebsite/wp-content/": "${workspaceRoot}/",
            }
        }
    ]
}

```

My experience has been that setting breakpoints visually can be iffy for triggering; I tend to add an xdebug() call in my code where I want it to halt. Just be careful you don’t leave them in when you push to Kinsta.

---

<div class="post-metadata">

### Author: ![Agus](https://sea2.discourse-cdn.com/flex020/user_avatar/community.kinsta.com/agus/32/1515_2.png) [@Agus](https://community.kinsta.com/u/Agus)
#### Post date: [January 19, 2023, 4:20am UTC](https://community.kinsta.com/t/xdebug-support-php-debugging/71/71 "2023-01-19T04:20:23Z")

</div>

Hi Don,

Thank you for sharing this information/test you did! 🙇‍♂️ .  
Hopefully that will be useful for other users as well! 👍 😃

Cheers,  
Agus

---

<div class="post-metadata">

### Author: ![Israel\_Estrada](https://sea2.discourse-cdn.com/flex020/user_avatar/community.kinsta.com/israel_estrada/32/3061_2.png) [@Israel\_Estrada](https://community.kinsta.com/u/Israel_Estrada)
#### Post date: [March 2, 2024, 5:10am UTC](https://community.kinsta.com/t/xdebug-support-php-debugging/71/72 "2024-03-02T05:10:35Z")

</div>

Awesome! this also worked for me 🚀

I’m using Windows 11 \> Docker (with WSL2) \> DevKinsta \> WordPress Site

Considering that PHP 8.x broke some functionalities, I’ve switched to 7.4 on DevKinsta.

On Windows power shell, access to docker bash:

`docker exec -it devkinsta_fpm bash`

then change directory where xdebug ini is:

`cd /etc/php/7.4/fpm/conf.d`

Modify file: `vim 20-xdebug.ini`

Add:

```auto
zend_extension=xdebug.so
xdebug.mode=develop,debug
xdebug.start_with_request=yes
xdebug.client_host=host.docker.internal
xdebug.client_port=9999
xdebug.idekey = VSCODE
xdebug.log = /var/log/fpm/xdebug.log
xdebug.log_level = 1

```

Save file, then exit docker devkinsta\_fpm bash

Finally on Windows power shell restart docker with:

`docker restart devkinsta_fpm`

Configure .vscode/launch.json

```auto
{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Listen for Xdebug",
            "type": "php",
            "request": "launch",
            "port": 9999,
            "pathMappings": {
            "/www/kinsta/public/YourSiteName": "${workspaceRoot}"
            }
        }
    ]
}

```

Rembember to change` YourSiteName` with your app name.

[Previous page](https://community.kinsta.com/t/xdebug-support-php-debugging/71.md?page=3)
