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.