Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/246.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
让Xdebug与Docker和PhpStorm正常工作(它连接)_Php_Docker_Debugging_Phpstorm - Fatal编程技术网

让Xdebug与Docker和PhpStorm正常工作(它连接)

让Xdebug与Docker和PhpStorm正常工作(它连接),php,docker,debugging,phpstorm,Php,Docker,Debugging,Phpstorm,更新:通过减少远程日志级别(我第一次遇到这个问题),并修复项目中丢失的一些文件(css、js和图像),这些文件会导致更多对nginx的调用,从而触发xdebug,实现了这一点。 谢谢你的评论 我对这个旧的CakePHP(2.8.*)项目有一些问题。 我有Docker(php7.1+nginx)和PhpStorm(2019.2.1构建#PS-192.6262.66,构建于2019年8月22日)作为IDE,下面是我的xdebug.ini(xdebug v2.9.6): 我能够从Xdebug获得连接,

更新:通过减少
远程日志级别(我第一次遇到这个问题),并修复项目中丢失的一些文件(css、js和图像),这些文件会导致更多对nginx的调用,从而触发xdebug,实现了这一点。
谢谢你的评论

我对这个旧的CakePHP(2.8.*)项目有一些问题。 我有Docker(php7.1+nginx)和PhpStorm(2019.2.1构建#PS-192.6262.66,构建于2019年8月22日)作为IDE,下面是我的xdebug.ini(xdebug v2.9.6):

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

因此,我可以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中做过:

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


因此,我的问题是,如何让Xdebug和PhpStorm正确映射其他文件并在断点处停止而不发疯?

“在几秒钟内,我得到了Xdebug.log文件,其中填充了数百行这样的代码:“--您已经将其配置为这样。摆脱
xdebug.remote_log_level=10
P.S.
/application
然后
/application/app
再然后
application/app/Controller
——孩子们从父节点继承映射。@LazyOne谢谢,我只是想让这个工作起来。这是我第一次这样做mapping@LazyOne关于
xdebug.remote_log_level=10
,我在其他应用程序上也有过这种调试级别,而且我以前从未见过这样的调试消息(不过使用默认的日志级别,从来没有必要更改)。您使用的Xdebug版本是什么?也许它是即将推出的Xdebug v3的新版本(尽管我认为您的PHP7.1可能不受支持)1请说明您的Xdebug和PhpStorm版本。2) 从开始到结束(但不包括那些额外的行),为这种失败的会话共享Xdebug日志。顺便问一下,109号线是它真正停的地方吗?我要求,因为在多行语句上设置断点是个坏主意——XDebug/PHP是如何工作的,断点的实际行将在中间某个地方…这就是为什么最好总是在单行/简单语句上设置断点。
[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)