使Xdebug与Docker和PhpStorm正常配合使用它可以连接

问题描述

更新:通过减少remote_log_level(这是我第一次遇到这个问题)并修复了项目中一些丢失的文件(css,js和图像)导致了对Nginx的更多调用等工作,触发xdebug。 感谢LazyOne评论

在这个旧的CakePHP(2.8。*)项目上,我遇到了一些问题。 我有Docker(PHP7.1 + Nginx),我正在使用PHPStorm(2019.2.1 Build#PS-192.6262.66,建于2019年8月22日)作为IDE,下面是我的xdebug.ini(Xdebug v2.9.6) :

xdebug.remote_enable=1
xdebug.remote_autostart=1
xdebug.remote_host=host.docker.internal
xdebug.remote_port=9000
xdebug.idekey=PHPSTORM-into-web
xdebug.remote_log="/application/xdebug.log"
xdebug.remote_log_level=10
xdebug.profiler_enable=0
xdebug.profiler_output_name=cachegrind.out.sid_%s.pid_%p
xdebug.remote_connect_back=0

我能够从Xdebug获得连接,并且它最初在我在/application/app/webroot/index.PHP处设置的断点处停止(CakePHP代码

enter image description here

所以我可以100%保证连接正在发生,这是正确的。问题是这个Xdebug疯了之后。

为了更清楚一点,在达到此初始断点(我还有更多)之后,IDE中再也没有发生任何事情,文件没有更改,但是我无法前进或前进。

几秒钟之内,我得到了xdebug.log文件,其中包含数百行:

[10] D: Checking whether to break on /application/app/Controller/IndexController.PHP:346
[10] D: I: Current location: /application/app/webroot/index.PHP:24
[10] D: I: Matching breakpoint '/application/app/Controller/IndexController.PHP:346' against location '/application/app/webroot/index.PHP:24'
[10] D: R: File name length (34) doesn't match with breakpoint (47)
[10] D: Checking whether to break on /application/app/Controller/IndexController.PHP:302
[10] D: I: Current location: /application/app/webroot/index.PHP:24
[10] D: I: Matching breakpoint '/application/app/Controller/IndexController.PHP:302' against location '/application/app/webroot/index.PHP:24'
[10] D: R: File name length (34) doesn't match with breakpoint (47)
[10] D: Checking whether to break on /application/app/webroot/index.PHP:109
[10] D: I: Current location: /application/app/webroot/index.PHP:24
[10] D: I: Matching breakpoint '/application/app/webroot/index.PHP:109' against location '/application/app/webroot/index.PHP:24'
[10] D: R: Line number (24) doesn't match with breakpoint (109)
[10] D: Checking whether to break on /application/app/Controller/IndexController.PHP:346
[10] D: I: Current location: /application/app/webroot/index.PHP:36
[10] D: I: Matching breakpoint '/application/app/Controller/IndexController.PHP:346' against location '/application/app/webroot/index.PHP:36'
[10] D: R: File name length (34) doesn't match with breakpoint (47)
[10] D: Checking whether to break on /application/app/Controller/IndexController.PHP:302
[10] D: I: Current location: /application/app/webroot/index.PHP:36
[10] D: I: Matching breakpoint '/application/app/Controller/IndexController.PHP:302' against location '/application/app/webroot/index.PHP:36'
[10] D: R: File name length (34) doesn't match with breakpoint (47)
[10] D: Checking whether to break on /application/app/webroot/index.PHP:109
[10] D: I: Current location: /application/app/webroot/index.PHP:36
[10] D: I: Matching breakpoint '/application/app/webroot/index.PHP:109' against location '/application/app/webroot/index.PHP:36'
[10] D: R: Line number (36) doesn't match with breakpoint (109)

几秒钟内xdebug.log超过20mb,阻止此行为的唯一方法是杀死服务器(使用docker-compose stop)。

所以问题可能出在我在PHPStorm中所做的映射上:

enter image description here

我通常只是将映射添加到第一个目录,但是在看到Xdebug问题后,我尝试添加其他文件夹,但这没有帮助。

所以我的问题是,如何使Xdebug和PHPStorm正确映射其他文件并在断点处停止而不发疯?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...