PhpStorm xdebug can't find file when connection comes from docker container PhpStorm xdebug can't find file when connection comes from docker container docker docker

PhpStorm xdebug can't find file when connection comes from docker container


I usually set the docker subnet IP as a remote host ip like this:

XDEBUG_CONFIG=remote_host=172.17.0.1PHP_IDE_CONFIG=serverName=your_server_name_in_phpstorm_settings

You could check ip in Linux with this command:

ifconfig docker0

Also if you're using docker-compose you could move xdebug variables definitions to a separate .env file and link it to the container config in docker-compose.yml:

container_name:    ...    env_file: .env    ......


I have the same issue when trying to debug on PHPStorm with docker.

I resolve it by adding server_name to nginx config

server_name _;// add this line to nginx config file

server {    listen 80;    server_name _;// add this line to nginx config file     index index.php index.html;    error_log  /var/log/nginx/error.log;    access_log /var/log/nginx/access.log;    root /var/www/public;    location ~ \.php$ {        try_files $uri =404;        fastcgi_split_path_info ^(.+\.php)(/.+)$;        fastcgi_pass app_bug:9000;        fastcgi_index index.php;        include fastcgi_params;        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;        fastcgi_param PATH_INFO $fastcgi_path_info;        include xdebug/remote.conf;    }    location / {        try_files $uri $uri/ /index.php?$query_string;        gzip_static on;    }}

Hope this helps someone still has the same problem with me


I faced with same problemTry to add in xdebug config this line:

xdebug.extended_info = 1

it should to pass env variable to $_SERVER