# 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:** 20
**Page:** 3

<div class="post-metadata">

### Author: ![dudo85](https://sea2.discourse-cdn.com/flex020/user_avatar/community.kinsta.com/dudo85/32/538_2.png) [@dudo85](https://community.kinsta.com/u/dudo85)
#### Post date: [June 8, 2021, 9:44pm UTC](https://community.kinsta.com/t/xdebug-support-php-debugging/71/43 "2021-06-08T21:44:50Z")

</div>

Hi all, I want just to share my steps to make this working with PhPStorm and Linux Mint

first, install xdebug

```auto
docker exec devkinsta_fpm bash -c 'apt-get update;apt-get -y install php7.0-xdebug php7.1-xdebug php7.2-xdebug php7.3-xdebug php7.4-xdebug php8.0-xdebug'

```

Then I added these lines on my xdebug.ini

```auto
zend_extension=xdebug.so
xdebug.mode=develop,debug
xdebug.client_host=172.19.0.1
xdebug.client_port=9003

```

and then I restart the container

`docker exec -it devkinsta_fpm bash`

Thank you all!

---

<div class="post-metadata">

### Author: ![philippstracker](https://sea2.discourse-cdn.com/flex020/user_avatar/community.kinsta.com/philippstracker/32/638_2.png) [@philippstracker](https://community.kinsta.com/u/philippstracker)
#### Post date: [August 19, 2021, 8:20pm UTC](https://community.kinsta.com/t/xdebug-support-php-debugging/71/44 "2021-08-19T20:20:23Z")

</div>

I really hope to see XDebug in DevKinsta soon without the manual setup/configuration.

---

<div class="post-metadata">

### Author: ![robruiz](https://avatars.discourse-cdn.com/v4/letter/r/8c91f0/32.png) [@robruiz](https://community.kinsta.com/u/robruiz)
#### Post date: [November 11, 2021, 3:18pm UTC](https://community.kinsta.com/t/xdebug-support-php-debugging/71/45 "2021-11-11T15:18:32Z")

</div>

I’m trying to figure out how to get this all set up. I’m having no luck. I added the following the xdebug.ini

```auto
zend_extension=xdebug.so
xdebug.mode=develop,debug
xdebug.client_host=172.19.0.1
xdebug.client_port=9003
xdebug.start_with_request = yes
xdebug.idekey = PHPSTORM
xdebug.log = /var/log/php/xdebug.log

```

 ![Screen Shot 2021-11-11 at 9.13.53 AM](https://us1.discourse-cdn.com/flex020/uploads/kinsta/original/1X/48ff0d91f2b60da107035e7c5ee9f9820d776d77.png)

I can’t get anything to work. Is there a correlating setting I am missing? I have the xdebug extension for chrome installed and running. I found the settings for it and it is looking for the PHPSTORM IDE key. I have PHPStorm listening and I even used the built in validation tool and it all checked out. So I’m not sure why my breakpoints aren’t catching.

Any help is much appreciated. Thank you.

What am I missing here?

---

<div class="post-metadata">

### Author: ![philippstracker](https://sea2.discourse-cdn.com/flex020/user_avatar/community.kinsta.com/philippstracker/32/638_2.png) [@philippstracker](https://community.kinsta.com/u/philippstracker)
#### Post date: [November 11, 2021, 4:38pm UTC](https://community.kinsta.com/t/xdebug-support-php-debugging/71/46 "2021-11-11T16:38:30Z")

</div>

Hi @robruiz - did you see the guide I’ve posted here?

> [@Guide: How to set up Xdebug (on DevKinsta) with PhpStorm](https://community.kinsta.com/t/guide-how-to-set-up-xdebug-on-devkinsta-with-phpstorm/944):
>
> I’ve struggled a bit with setting up Xdebug + DevKinsta in PhpStorm. So, here is my documentation and guide, which will save you a lot of time. Note: When you see a point_left emoji, you need to customize a value. However, most steps are generic, and you do not need to change anything; just copy-paste what’s in this guide. A. Create a setup script Place the following bash script in your DevKinsta/private folder. Usually, that folder is in your user’s home directory. Name the script setup-x…

I’m not familiar with the dialog in your screenshot. I’ve configured Xdebug via “PhpStorm \> Preferences… \> PHP \> Debug”

Also, I do not use an IDE key, as I enable or disable debugging via the Chrome extension. Generally, the IDE key caused problems for me in the past, so I never use it. I always enable or disable Xdebug in the whole environment instead of using IDE keys/session ids.

Aside from that, I recommend clicking the “Validate” link in your “Pre-configuration” section. Possibly, you will get some additional tips from PhpStorm on what’s failing.

---

<div class="post-metadata">

### Author: ![robruiz](https://avatars.discourse-cdn.com/v4/letter/r/8c91f0/32.png) [@robruiz](https://community.kinsta.com/u/robruiz)
#### Post date: [November 11, 2021, 5:13pm UTC](https://community.kinsta.com/t/xdebug-support-php-debugging/71/47 "2021-11-11T17:13:52Z")

</div>

> [@philippstracker](#):
>
> did you see the guide I’ve posted here?

I did not stumble upon this. Thank you so much for pointing it out. I’m gonna run through this and give it a try. Thanks!

---

<div class="post-metadata">

### Author: ![Dan0sz](https://sea2.discourse-cdn.com/flex020/user_avatar/community.kinsta.com/dan0sz/32/861_2.png) [@Dan0sz](https://community.kinsta.com/u/Dan0sz)
#### Post date: [January 8, 2022, 9:28pm UTC](https://community.kinsta.com/t/xdebug-support-php-debugging/71/48 "2022-01-08T21:28:43Z")

</div>

Any updates on this? It’s been a year and still nothing.

---

<div class="post-metadata">

### Author: ![Dan0sz](https://sea2.discourse-cdn.com/flex020/user_avatar/community.kinsta.com/dan0sz/32/861_2.png) [@Dan0sz](https://community.kinsta.com/u/Dan0sz)
#### Post date: [January 8, 2022, 10:25pm UTC](https://community.kinsta.com/t/xdebug-support-php-debugging/71/49 "2022-01-08T22:25:43Z")

</div>

I got a notice that port 9003 was already in use. I didn’t want to debug it, so I just changed it to 9999 in xdebug.ini and launch.json. And it worked! Awesome! Thanks!

---

<div class="post-metadata">

### Author: ![jscotti](https://avatars.discourse-cdn.com/v4/letter/j/8dc957/32.png) [@jscotti](https://community.kinsta.com/u/jscotti)
#### Post date: [June 9, 2022, 10:36pm UTC](https://community.kinsta.com/t/xdebug-support-php-debugging/71/50 "2022-06-09T22:36:16Z")

</div>

@sonicviz guide worked great until I recently updated to the latest DevKinsta and now it no longer works. Breakpoints are entirely ignored. It’s unbelievable that something this basic has not been addressed by the devs after this long. Wordpress is based on PHP and yet debugging PHP is somehow not supported without tons of effort, and it won’t last if you keep the app updated, apparently. Word to the wise if you are finding this page because you’re having the same issues we all did; if you get it to work DO NOT UPDATE DevKinsta until they announce official support for this basic feature.

---

<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: [June 10, 2022, 12:16am UTC](https://community.kinsta.com/t/xdebug-support-php-debugging/71/51 "2022-06-10T00:16:08Z")

</div>

That’s worrying. Can anyone else confirm this?  
I’ll try and test it asap to see as well.

---

<div class="post-metadata">

### Author: ![jscotti](https://avatars.discourse-cdn.com/v4/letter/j/8dc957/32.png) [@jscotti](https://community.kinsta.com/u/jscotti)
#### Post date: [June 10, 2022, 4:46pm UTC](https://community.kinsta.com/t/xdebug-support-php-debugging/71/52 "2022-06-10T16:46:18Z")

</div>

Yeah it’s a real bummer. I went back through and confirmed that the xdebug.ini file is where it should be and configured correctly, nothing changed in my VSCode config, but when I run debug mode the breakpoints are ignored and the only thing I did was update DevKinsta to the latest version after ignoring the update notices for quite some time. I’m totally baffled.

---

<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: [June 10, 2022, 5:42pm UTC](https://community.kinsta.com/t/xdebug-support-php-debugging/71/53 "2022-06-10T17:42:22Z")

</div>

Hi everyone, I just wanted to drop a development update here:

Our devs have been using 2022 to integrate the most requested features into DevKinsta. At our current pace, built-in Xdebug support will be added during Q4 of 2022 along with other development-related features (like GIT integration). You can track our release progress here: [https://community.kinsta.com/t/devkinsta-releases-minor/](https://community.kinsta.com/t/devkinsta-releases-minor/)

I’m unsure of what change may have caused this workaround to no longer work, but I’ll make sure we notify this thread when DevKinsta officially supports Xdebug.

---

<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: [June 10, 2022, 11:41pm UTC](https://community.kinsta.com/t/xdebug-support-php-debugging/71/54 "2022-06-10T23:41:45Z")

</div>

Thanks for the update.

Q4 for xDebug support seems a little shabby tbh, considering debugging is a core developer task.  
I would have thought you would give this a higher priority.

---

<div class="post-metadata">

### Author: ![jscotti](https://avatars.discourse-cdn.com/v4/letter/j/8dc957/32.png) [@jscotti](https://community.kinsta.com/u/jscotti)
#### Post date: [June 15, 2022, 6:40pm UTC](https://community.kinsta.com/t/xdebug-support-php-debugging/71/55 "2022-06-15T18:40:35Z")

</div>

Yeah, appreciate the update. Glad to hear you are working on it, but I’m forced to agree that a Q4 rollout for this feature is lacking. It’s critical that we are able to debug, and now the work around no longer works, I’m sort of dead in the water when it comes to anything PHP related.

---

<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: [June 15, 2022, 11:49pm UTC](https://community.kinsta.com/t/xdebug-support-php-debugging/71/56 "2022-06-15T23:49:54Z")

</div>

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 longer works and I had to use my ip address. I don’t know if that’s due to a DK change or a Docker one. I also changed the `x.debug.idekey` to “docker” but I’m not sure if that makes a big difference or not. Another setting I added was `xdebug.discover_client_host=true`.

Below is my working configuration for Windows 10, WSL2:

**/etc/php/7.4.fpm/conf.d**

```auto
zend_extension=xdebug.so
xdebug.mode = debug
xdebug.start_with_request = yes
xdebug.client_port = 9003
xdebug.idekey = "docker"
xdebug.client_host = <my ip address>
xdebug.log = /var/log/php/xdebug.log
xdebug.discover_client_host=true

```

**Finding your IP address:**

Mac:

```auto
ipconfig getifaddr en0

```

Windows (run command within WSL):

```auto
grep nameserver /etc/resolv.conf | cut -d ' ' -f2

```

Linux:

```auto
hostname -I | cut -d ' ' -f1

```

My launch.json still matches what has been [shared](https://community.kinsta.com/t/xdebug-support-php-debugging/71/35).

Tested and working when viewing my WP Homepage:

 ![image](https://us1.discourse-cdn.com/flex020/uploads/kinsta/original/2X/3/350fb49c459566afcea0505ade204721d3cf9b56.png)

So based on my many hours of troubleshooting, I think the issue that has popped up can be resolved by editing the xdebug config/restarting that container. Please let me know if this doesn’t work for you and I can put together a more in-depth guide. My goal here was to reproduce the issue and provide a solution while we wait for the DevKinsta update.

---

<div class="post-metadata">

### Author: ![jscotti](https://avatars.discourse-cdn.com/v4/letter/j/8dc957/32.png) [@jscotti](https://community.kinsta.com/u/jscotti)
#### Post date: [June 16, 2022, 6:09pm UTC](https://community.kinsta.com/t/xdebug-support-php-debugging/71/57 "2022-06-16T18:09:39Z")

</div>

@Kevin Legend! That works perfectly, thanks so much for taking the time to figure out the work around, it’s very much appreciated!

---

<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: [June 20, 2022, 4:25am UTC](https://community.kinsta.com/t/xdebug-support-php-debugging/71/58 "2022-06-20T04:25:44Z")

</div>

Thanks for taking the time to do that.

---

<div class="post-metadata">

### Author: ![bethkessler](https://avatars.discourse-cdn.com/v4/letter/b/e47774/32.png) [@bethkessler](https://community.kinsta.com/u/bethkessler)
#### Post date: [June 21, 2022, 3:52pm UTC](https://community.kinsta.com/t/xdebug-support-php-debugging/71/59 "2022-06-21T15:52:12Z")

</div>

Worked perfectly, thank you Kevin. I followed all the steps you outlined except changing my xdebug.idekey to docker. I left that set to VSCODE (my ide key) so it works with the cookie set by the xdebug helper chrome extension.

---

<div class="post-metadata">

### Author: ![Greg36](https://avatars.discourse-cdn.com/v4/letter/g/8e7dd6/32.png) [@Greg36](https://community.kinsta.com/u/Greg36)
#### Post date: [August 2, 2022, 2:15pm UTC](https://community.kinsta.com/t/xdebug-support-php-debugging/71/60 "2022-08-02T14:15:30Z")

</div>

I did use the great PHPstorm guide from @philippstracker when I validate xdebug connection to my [https://mysite.local](https://mysite.local) it is validated:

[debugger validate screenshot](https://imgur.com/a/u4Tqrfu)

But PHPstorm receives no connections from xdebug, I’ve tried using `xdebug.client_host = host.docker.internal`, 172.172.0.1 and the WSL IP as suggested by @Kevin but no results. I tried changing port to 9001 or 9002, changing timeout of xdebug and nothing.  
I have listening turned on in PHPstorm, chrome debug extension on, I set a breakpoint, refresh the page and no connection.

When I run xdebug\_info() I get this output:

```auto
[Step Debug] Creating socket for '172.172.0.1:9003', poll success, but error: Operation now in progress (29).
[Step Debug] Could not connect to client host discovered through HTTP headers, connecting to configured address/port: 172.17.176.1:9003. :-|
[Step Debug] Time-out connecting to debugging client, waited: 200 ms. Tried: 172.172.0.1:9003 (from REMOTE_ADDR HTTP header), 172.17.176.1:9003 (fallback through xdebug.client_host/xdebug.client_port) :-(

```

Any ideas on how to debug this debugger issue? I’m starting to lose my mind over this.

---

<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: [August 3, 2022, 12:06am UTC](https://community.kinsta.com/t/xdebug-support-php-debugging/71/61 "2022-08-03T00:06:42Z")

</div>

Hi @Greg36, welcome to DevKinsta! Unfortunately I’m not well versed with PhpStorm so I can’t give much advice here. I did try installing a trial version but couldn’t get it working consistently/was faced with a lot of configuration issues.

You could try getting xDebug to work with VSCode using the steps that have worked for others, perhaps that might help you track down the PhpStorm configuration issue.

Hopefully someone who has PhpStorm working with DevKinsta will chime in and share their configuration if the previous one no longer works.

---

<div class="post-metadata">

### Author: ![Greg36](https://avatars.discourse-cdn.com/v4/letter/g/8e7dd6/32.png) [@Greg36](https://community.kinsta.com/u/Greg36)
#### Post date: [August 3, 2022, 12:58pm UTC](https://community.kinsta.com/t/xdebug-support-php-debugging/71/62 "2022-08-03T12:58:13Z")

</div>

I’ve spent a few more hours on this topic, reinstalled everything including Docker Desktop, and finally, I found what the problem was - **ports**. But they were not blocked on WSL2 firewall but on the Windows firewall somehow. I run the following command and xdebug picked up breakpoint for host from IP in `/etc/resolv.conf` file in WSL. All running good now 🙂  
`New-NetFirewallRule -DisplayName "WSL" -Direction Inbound -InterfaceAlias "vEthernet (WSL)" -Action Allow`

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

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