# 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:** 1

<div class="post-metadata">

### Author: ![okkins](https://avatars.discourse-cdn.com/v4/letter/o/73ab20/32.png) [@okkins](https://community.kinsta.com/u/okkins)
#### Post date: [January 18, 2021, 2:58pm UTC](https://community.kinsta.com/t/xdebug-support-php-debugging/71/1 "2021-01-18T14:58:26Z")

</div>

The title says it all. I wonder if PHP debugging is supported?

---

<div class="post-metadata">

### Author: ![Andre\_Gagnon](https://sea2.discourse-cdn.com/flex020/user_avatar/community.kinsta.com/andre_gagnon/32/56_2.png) [@Andre\_Gagnon](https://community.kinsta.com/u/Andre_Gagnon)
#### Post date: [January 18, 2021, 4:07pm UTC](https://community.kinsta.com/t/xdebug-support-php-debugging/71/2 "2021-01-18T16:07:48Z")

</div>

I don’t know about xdebug, but I think you can log to the error log and check things there. If you’re on Mac, this should be

`Users/{yourname}/DevKinsta/logs`

---

<div class="post-metadata">

### Author: ![Andre\_Gagnon](https://sea2.discourse-cdn.com/flex020/user_avatar/community.kinsta.com/andre_gagnon/32/56_2.png) [@Andre\_Gagnon](https://community.kinsta.com/u/Andre_Gagnon)
#### Post date: [January 18, 2021, 4:10pm UTC](https://community.kinsta.com/t/xdebug-support-php-debugging/71/3 "2021-01-18T16:10:51Z")

</div>

Here’s some more info: [Logging and Site Debugging - DevKinsta - Kinsta](https://kinsta.com/knowledgebase/devkinsta/logging/)

---

<div class="post-metadata">

### Author: ![michael](https://sea2.discourse-cdn.com/flex020/user_avatar/community.kinsta.com/michael/32/31_2.png) [@michael](https://community.kinsta.com/u/michael)
#### Post date: [January 18, 2021, 4:19pm UTC](https://community.kinsta.com/t/xdebug-support-php-debugging/71/4 "2021-01-18T16:19:50Z")

</div>

Thanks @Andre_Gagnon !

@okkins Let us know if you have any trouble finding the logs.

---

<div class="post-metadata">

### Author: ![okkins](https://avatars.discourse-cdn.com/v4/letter/o/73ab20/32.png) [@okkins](https://community.kinsta.com/u/okkins)
#### Post date: [January 18, 2021, 5:53pm UTC](https://community.kinsta.com/t/xdebug-support-php-debugging/71/5 "2021-01-18T17:53:55Z")

</div>

Yes, I saw the logs. My question is whether xdebug is enabled in the php build DevKinsta is using? The documentation doesn’t indicate anything about debugging. I’m hoping xdebug is included 🙂

---

<div class="post-metadata">

### Author: ![ramyallam](https://avatars.discourse-cdn.com/v4/letter/r/13edae/32.png) [@ramyallam](https://community.kinsta.com/u/ramyallam)
#### Post date: [January 19, 2021, 11:00am UTC](https://community.kinsta.com/t/xdebug-support-php-debugging/71/6 "2021-01-19T11:00:05Z")

</div>

Heey @okkins 😃 👋  
xdebug extension is not enabled on the current release of DevKinsta but you can install it using the below commands

```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'
docker restart devkinsta_fpm

```

_Note: Any custom change might be defaulted during containers recycle such as DevKinsta upgrades_

---

<div class="post-metadata">

### Author: ![okkins](https://avatars.discourse-cdn.com/v4/letter/o/73ab20/32.png) [@okkins](https://community.kinsta.com/u/okkins)
#### Post date: [January 19, 2021, 1:22pm UTC](https://community.kinsta.com/t/xdebug-support-php-debugging/71/7 "2021-01-19T13:22:46Z")

</div>

Thank you! And do I also need to update the php config or is that handled automatically? I’m not sure where to update php config in docker.

---

<div class="post-metadata">

### Author: ![michael](https://sea2.discourse-cdn.com/flex020/user_avatar/community.kinsta.com/michael/32/31_2.png) [@michael](https://community.kinsta.com/u/michael)
#### Post date: [January 19, 2021, 5:13pm UTC](https://community.kinsta.com/t/xdebug-support-php-debugging/71/8 "2021-01-19T17:13:15Z")

</div>

The config files stored inside the containers and are automatically configured but you’re free to edit them as well. You can enter into the container via the following commands:

NGINX:  
`docker exec -it devkinsta_nginx bash`

FPM:  
`docker exec -it devkinsta_fpm bash`

---

<div class="post-metadata">

### Author: ![okkins](https://avatars.discourse-cdn.com/v4/letter/o/73ab20/32.png) [@okkins](https://community.kinsta.com/u/okkins)
#### Post date: [January 19, 2021, 6:05pm UTC](https://community.kinsta.com/t/xdebug-support-php-debugging/71/9 "2021-01-19T18:05:06Z")

</div>

Got it. If the xdebug install configures php correctly that works. I’ll try that and see how it goes. Thanks!

---

<div class="post-metadata">

### Author: ![okkins](https://avatars.discourse-cdn.com/v4/letter/o/73ab20/32.png) [@okkins](https://community.kinsta.com/u/okkins)
#### Post date: [January 20, 2021, 8:27pm UTC](https://community.kinsta.com/t/xdebug-support-php-debugging/71/10 "2021-01-20T20:27:11Z")

</div>

When I run this command I get:  
Reading package lists…  
Building dependency tree…  
Reading state information…  
E: Unable to locate package php7.0-xdebug  
E: Couldn’t find any package by glob ‘php7.0-xdebug’  
E: Couldn’t find any package by regex ‘php7.0-xdebug’  
E: Unable to locate package php7.1-xdebug  
E: Couldn’t find any package by glob ‘php7.1-xdebug’  
E: Couldn’t find any package by regex ‘php7.1-xdebug’  
E: Unable to locate package php7.2-xdebug  
E: Couldn’t find any package by glob ‘php7.2-xdebug’  
E: Couldn’t find any package by regex ‘php7.2-xdebug’  
E: Unable to locate package php7.3-xdebug  
E: Couldn’t find any package by glob ‘php7.3-xdebug’  
E: Couldn’t find any package by regex ‘php7.3-xdebug’  
E: Unable to locate package php7.4-xdebug  
E: Couldn’t find any package by glob ‘php7.4-xdebug’  
E: Couldn’t find any package by regex ‘php7.4-xdebug’  
E: Unable to locate package php8.0-xdebug  
E: Couldn’t find any package by glob ‘php8.0-xdebug’  
E: Couldn’t find any package by regex ‘php8.0-xdebug’

---

<div class="post-metadata">

### Author: ![michael](https://sea2.discourse-cdn.com/flex020/user_avatar/community.kinsta.com/michael/32/31_2.png) [@michael](https://community.kinsta.com/u/michael)
#### Post date: [January 20, 2021, 8:47pm UTC](https://community.kinsta.com/t/xdebug-support-php-debugging/71/11 "2021-01-20T20:47:04Z")

</div>

Try running `apt-get update && apt-get upgrade` first and let us know if this helps.

---

<div class="post-metadata">

### Author: ![okkins](https://avatars.discourse-cdn.com/v4/letter/o/73ab20/32.png) [@okkins](https://community.kinsta.com/u/okkins)
#### Post date: [January 21, 2021, 12:16am UTC](https://community.kinsta.com/t/xdebug-support-php-debugging/71/12 "2021-01-21T00:16:13Z")

</div>

Yes, that worked and it installed. Now phpinfo() shows xdebug. However, when I started Visual Studio Code with the following config I’m not getting any debugging:

```
{
            "name": "Listen for XDebug",
            "type": "php",
            "request": "launch",
            "port": 9003,
            "log": true,
        },
```

---

<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: [January 21, 2021, 1:05pm UTC](https://community.kinsta.com/t/xdebug-support-php-debugging/71/13 "2021-01-21T13:05:56Z")

</div>

> [@Xdebug Support: PHP debugging](https://community.kinsta.com/t/does-devkinsta-support-php-debugging/71/12):
>
> Yes, that worked and it installed. Now phpinfo() shows xdebug. However, when I started Visual Studio Code with the following config I’m not getting any debugging: { "name": "Listen for XDebug", "type": "php", "request": "launch", "port": 9003, "log": true, },

I’m stuck at this point too – my guess is that we need to configure Xdebug remote access so that VS code can bridge into docker but would rather receive instructions from the DevKinsta developers before starting to play with configuration files!

---

<div class="post-metadata">

### Author: ![michael](https://sea2.discourse-cdn.com/flex020/user_avatar/community.kinsta.com/michael/32/31_2.png) [@michael](https://community.kinsta.com/u/michael)
#### Post date: [January 22, 2021, 4:42pm UTC](https://community.kinsta.com/t/xdebug-support-php-debugging/71/15 "2021-01-22T16:42:18Z")

</div>

My understanding is that a remote connection is required for xdebug to function with Docker. [Let me know if this guide here helps](https://dev.to/fuxide/setting-up-xdebug-for-vscode-in-an-docker-environment-27a9).

---

<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: [January 27, 2021, 5:13am UTC](https://community.kinsta.com/t/xdebug-support-php-debugging/71/16 "2021-01-27T05:13:01Z")

</div>

I’m not sure how to apply the guide to the docker containers, which PHP configuration files would be applicable and what should the pathMapping values be in the launch json?

What I was hoping for is something similar to the Add-On in local that configures everything:

 ![image](https://us1.discourse-cdn.com/flex020/uploads/kinsta/original/1X/bd6d0ff1ee15b744acf662801c2715724bf67ef5.jpeg)

---

<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: [January 27, 2021, 8:39am UTC](https://community.kinsta.com/t/xdebug-support-php-debugging/71/18 "2021-01-27T08:39:18Z")

</div>

Hi @michael

I’ve tried following the guide you shared but no joy so far (I’m using Chrome and the Xdebug browser plugin)! This is where I am:

macbookpro ~ % **docker exec -it devkinsta\_fpm bash**

```
root@2dedc43b17cc:/etc/php/7.4/fpm/conf.d# cat 20-xdebug.ini 
zend_extension=xdebug.so
xdebug.remote_enable=1
xdebug.remote_autostart=1
xdebug.remote_connect_back=0
xdebug.remote_host=docker.for.mac.localhost
xdebug.max_nesting_level=1500

```

macbookpro ~ % **exit**

macbookpro ~ % **docker restart devkinsta\_fpm**

In visual studio code my launch json is configured as below:

~/DevKinsta/public/greenfins/.vscode/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": 9003,
            "pathMappings": {
                "/www/kinsta/public/greenfins": "${workspaceFolder}"
            }
        },
        {
            "name": "Launch currently open script",
            "type": "php",
            "request": "launch",
            "program": "${file}",
            "cwd": "${fileDirname}",
            "port": 9003
        }
    ]
}

```

For good measure I also tried the following because it looks like Xdebug 3 was installed when following the steps from @ramyallam and the guide you shared was for Xdebug 2:

```
root@2dedc43b17cc:/etc/php/7.4/fpm/conf.d# cat 20-xdebug.ini 
zend_extension=xdebug.so
xdebug.mode=debug
xdebug.start_with_request=yes
xdebug.idekey=VSCODE
xdebug.remote_connect_back=0
xdebug.remote_host=host.docker.internal

```

and…

```
zend_extension=xdebug.so
xdebug.mode = debug
xdebug.start_with_request = yes
xdebug.idekey = VSCODE
xdebug.remote_connect_back = 0
xdebug.remote_host = kubernetes.docker.internal

```

Still no joy!

I wonder whether Docker needs some more configuration as per [https://sebastianhamalainen.com/blog/debug-php-with-vscode-and-docker](https://sebastianhamalainen.com/blog/debug-php-with-vscode-and-docker) (add `XDEBUG_ENABLE` and `DOCKERHOST` lines under `x-environment` in `docker-compose.yml` file). I can’t currently find where DevKinsta stores the compose files, are you able to give me a steer?

Could really do some input from the DevKinsta devs because otherwise I will have to go back to Local (which I really don’t want to do - Kinsta hosting has been flawless so far).

---

<div class="post-metadata">

### Author: ![michael](https://sea2.discourse-cdn.com/flex020/user_avatar/community.kinsta.com/michael/32/31_2.png) [@michael](https://community.kinsta.com/u/michael)
#### Post date: [January 27, 2021, 4:21pm UTC](https://community.kinsta.com/t/xdebug-support-php-debugging/71/19 "2021-01-27T16:21:51Z")

</div>

I’m sorry for the trouble here @jamesgreenblue . We’ll add this as a possible feature of DevKinsta to make this process easier for those using xdebug. I’ll move this thread over to Feature Requests category too and I’ve notified our developers.

---

<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: [January 28, 2021, 3:51am UTC](https://community.kinsta.com/t/xdebug-support-php-debugging/71/20 "2021-01-28T03:51:33Z")

</div>

No worries. Thank you for flagging to the developers – I’m happy to assist with testing (and happy to be contacted directly) if that is helpful to get to the bottom of this. Cheers.

---

<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: [February 28, 2021, 7:56am UTC](https://community.kinsta.com/t/xdebug-support-php-debugging/71/21 "2021-02-28T07:56:11Z")

</div>

Hi @michael, any chance of an update on this? Really need it to move forward with some changes to our Kinsta-hosted site!

---

<div class="post-metadata">

### Author: ![michael](https://sea2.discourse-cdn.com/flex020/user_avatar/community.kinsta.com/michael/32/31_2.png) [@michael](https://community.kinsta.com/u/michael)
#### Post date: [March 1, 2021, 4:10pm UTC](https://community.kinsta.com/t/xdebug-support-php-debugging/71/22 "2021-03-01T16:10:24Z")

</div>

Hi @jamesgreenblue . No updates yet I’m afraid.

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