找不到源位置错误

找不到源位置错误

本文介绍了Docker,PhpStorm和Xdebug:找不到源位置错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我建立了一个基于php:5.6-fpm-alpine图像的图像,并且我运行了一个基于symfony的应用程序,因此我同时运行了cli和基于web的php脚本.

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"

并且已经按照以下链接中的说明设置了IDE:

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

但是当我在phpstorm上启用Xdebug时,即使它正常调试,我也会收到以下错误消息:

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

你知道为什么会这样吗.

Do you know why that happens.

推荐答案

之所以发生,是因为phpstorm的Servers部分的名称与PHP_IDE_CONFIG环境变量中定义的名称不完全相同,以解决以下问题这些步骤:

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:

第1步:通过按Ctrl + Alt + S或从菜单访问File-> Settings进入服务器设置.

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

第2步:然后在打开的窗口中转到设置->语言和框架->服务器.

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

第3步:Name设置为以下内容之一:

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

export PHP_IDE_CONFIG="serverName=0.0.0.0:5092"

要正常工作,如图所示,应该为0.0.0.0:5092

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

这篇关于Docker,PhpStorm和Xdebug:找不到源位置错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-07 06:47