# Remote debugging PHP Docker container

**URL:** <https://forums.docker.com/t/remote-debugging-php-docker-container/64785>\
**Category:** General\
**Created:** [December 10, 2018, 3:47pm UTC](https://forums.docker.com/t/remote-debugging-php-docker-container/64785 "2018-12-10T15:47:02Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![dsfhmr](https://avatars.discourse-cdn.com/v4/letter/d/df788c/32.png) [@dsfhmr](https://forums.docker.com/u/dsfhmr)\
**Post date:** [December 10, 2018, 3:47pm UTC](https://forums.docker.com/t/remote-debugging-php-docker-container/64785/1 "2018-12-10T15:47:02Z")

</div>

Hello,

I am trying to setup PhpStorm or Eclipse to debug a docker container installed on a server using Xdebug and Eclipse/PhpStorm. The IDE is on my local computer (Windows 10) and the PHP app is on a Debian 9 VM. The docker container uses Ubuntu. I use docker compose and my app is a PHP API based on Phalcon framework.

For now the only thing i managed to do is to make it stop in index.php using a Firefox extension (Xdebug helper). If i use Postman doing any request (GET/POST/DELETE) or another browser without extensions, it does not communicate with my local IDE.

I tried putting this in docker-compose.yml :

```
    environment:
      XDEBUG_CONFIG: remote_host=192.168.0.1
      PHP_IDE_CONFIG: "serverName=docker"
      XDEBUG_CONFIG: "idekey=PHPSTORM"
      PHP_XDEBUG_ENABLED: 1

```

I tried putting this in php.ini (which is copied by Dockerfile at container building)

```
error_reporting=E_ALL
display_errors=1
xdebug.remote_host=$MY IDE IP
xdebug.remote_enable=1 # enable remote debugging for all hosts, which use this php.ini
xdebug.remote_handler=dbgp # debugger protocol, you may change this value to 'gdp' if your IDE is supporting only this
xdebug.remote_mode=req # Xdebug tries to connect to your IDE as soon as you start a script, you can choose 'jit' when Xdebug shall connect to our IDE only when an error condition occurs
xdebug.remote_port=9000 # default port for Xdebug
xdebug.remote_autostart=0

```

I have a script to launch the container which does :

```
docker-compose -f docker-compose-remote.yml down;docker rmi epackv3/api;docker-compose -f docker-compose-remote.yml build --no-cache;docker-compose -f docker-compose-remote.yml up -d

```

On PhpStorm i have a server in Languages & Frameworks \> PHP \> Servers with the IP of my VM hosting the docker container on port 9000 (Xdebug). The force break option is activated and i have a copy of my php code on the IDE

What do you think i am missing ? It’s been 1 week i am trying what i can find online with no success.

Feel free to ask my anything if you need more informations.

Thanks for your help.

---

<div class="post-metadata">

**Author:** ![busaev](https://sea3.discourse-cdn.com/docker/user_avatar/forums.docker.com/busaev/32/22207_2.png) [@busaev](https://forums.docker.com/u/busaev)\
**Post date:** [December 29, 2018, 7:31am UTC](https://forums.docker.com/t/remote-debugging-php-docker-container/64785/2 "2018-12-29T07:31:59Z")

</div>

If you use php-fpm check config of php-fpm pool:

Uncomment line:

`clear_env=no`

Default value yes - it clear all environment variables, include PHP\_IDE\_CONFIG
