28

I built an image that is based on a php:5.6-fpm-alpine image and I run a symfony-based application therefore I run both cli and web-based php scripts.

So I spawned a shell over my running container via:

docker exec -ti ^container_id^ /bin/sh

And over the shell I exported the following enviromental variables:

export PHP_IDE_CONFIG="serverName=0.0.0.0:5092"
export XDEBUG_CONFIG="idekey=PHPSTORM"

And the IDE has been setup as explained in the following links:

But when I enable the Xdebug on phpstorm even it debugs normally I get the following error message:

Error displayed into my PHPSTORM running instance

Do you know why that happens.

Dimitrios Desyllas
  • 9,082
  • 15
  • 74
  • 164

1 Answers1

53

That happend because on Servers section of the phpstorm does not have the very same name as defined in the PHP_IDE_CONFIG enviromental variable in order to solve that follow these steps:

Step 1: Go to server settings by pressing Ctrl+Alt+S or by visiting File -> Settings from the menu.

Step 2: Then on the open window go to Settings -> Languages & Framework -> Servers.

Step 3: Set the Name as the one defined into:

export PHP_IDE_CONFIG="serverName=0.0.0.0:5092"

In order to work it should be 0.0.0.0:5092 as the image shows:

Server Setting here

Shiro
  • 7,344
  • 8
  • 46
  • 80
Dimitrios Desyllas
  • 9,082
  • 15
  • 74
  • 164
  • 5
    Thank you! The only thing that is a bit confusing is that it should state that Name should equal the servername that is being exported. By looking at the example it seems that any name can be used. I tried hello and failed. Once I added the ip and port it worked. – nitefrog Jun 20 '18 at 01:30
  • 1
    I have the same problem, but, when I try to save, phpstorm says that "sarver name is not specified or invalid" and I can't save it. Also, my debug is working, but not stops on breaking points, does anyone know the reason? – Victor Gazotti Aug 08 '18 at 21:23
  • I only figure out when the Name need to be same and must with the post number as well. – Shiro Nov 27 '20 at 13:49
  • I just figured out the "server name is not specified or invalid"... There's another entry in your servers list that is blank, delete it and that problem goes away. – stu Mar 19 '21 at 19:50