Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Docker, PhpStorm & Xdebug: Can't find source position error

Tags:

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:

  • Can't connect PhpStorm with xdebug with Docker
  • How to setup Docker + PhpStorm + xdebug on Ubuntu 16.04

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.

like image 477
Dimitrios Desyllas Avatar asked Feb 25 '18 19:02

Dimitrios Desyllas


People also ask

How to use Docker with PhpStorm?

PhpStorm supports alternative Docker daemons: Colima and Rancher Desktop (with the dockerd engine). Configure the Docker daemon connection settings: Press Ctrl+Alt+S to open the IDE settings and select Build, Execution, Deployment | Docker. to add a Docker configuration and specify how to connect to the Docker daemon.

What is a docker machine?

Docker Machine is a tool for provisioning and managing your Dockerized hosts (hosts with Docker Engine on them). Typically, you install Docker Machine on your local system. Docker Machine has its own command line client docker-machine and the Docker Engine client, docker.


1 Answers

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

like image 95
Dimitrios Desyllas Avatar answered Nov 09 '22 05:11

Dimitrios Desyllas