I have a Docker container with xdebug in it, when I run the script I need to form the Docker container I receive from PhpStorm the following message:
Cannot parse server name for external Xdebug connection.
To fix it create environment variable PHP_IDE_CONFIG on the remote server.
Windows: set PHP_IDE_CONFIG="serverName=SomeName"
Linux / Mac OS X: export PHP_IDE_CONFIG="serverName=SomeName".
but I have already set those environment variables as you can see in the screenshot here:
Here is the xdebug section from my phpinfo()
:
And these are my settings for PhpStorm:
Environment from phpinfo()
:
PHP Variables from phpinfo()
:
I also tried to export
env variables with and without quotes but the result was the same...
With quotes:
XDEBUG_CONFIG="remote_host=192.168.1.110"
PHP_IDE_CONFIG="serverName=docker-server"
Without quotes:
XDEBUG_CONFIG=remote_host=192.168.1.110
PHP_IDE_CONFIG=serverName=docker-server
The result from ifconfig en1 inet
command from my MacOS where I'm running Docker and PhpStorm
You can also check the following files in cases needed:
Any help will be much appreciated!
Update:
Seems that if I add
environment:
XDEBUG_CONFIG: "remote_host=192.168.1.110"
PHP_IDE_CONFIG: "serverName=docker-server"
into my php
service located inside docker-compose.yml it solves the issue but leaves me with a big question.
Since I have:
env_file:
- ./etc/environment.yml
- ./etc/environment.development.yml
and inside ./etc/environment.development.yml
I have:
XDEBUG_CONFIG="remote_host=192.168.1.110"
PHP_IDE_CONFIG="serverName=docker-server"
And since it is not ignored and I can see that those Env variables are set even before I add environment
property into my php
service, why xdebug is only triggered when I have set the environment
property? It feels like duplication for me to have it in both places and I prefer to have it inside ./etc/environment.development.yml
rather than docker-compose.yml
.