PHPStorm/调试器不会在某些断点处停止 [英] PHPStorm / debugger not stopping at certain breakpoints

查看:107
本文介绍了PHPStorm/调试器不会在某些断点处停止的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经为Mac OS(Apache 2.2.22,PHP 5.3.15)设置了带有标准LAMP堆栈的XDebug(2.2.1)和PHPStorm-IDE(Mac OS X 10.7.5).

I've set up XDebug (2.2.1) and PHPStorm-IDE (Mac OS X 10.7.5) with standard LAMP stack for Mac OS (Apache 2.2.22, PHP 5.3.15).

/etc/php.ini

[xdebug]
zend_extension=/usr/lib/php/extensions/no-debug-non-zts-20090626/xdebug.so
xdebug.file_link_format="txmt://open?url=file://%f&line=%1"
xdebug.remote_enable = On
xdebug.remote_autostart = "PHPSTORM"
xdebug.var_display_max_data = 1024
xdebug.dump.GET=*
xdebug.dump.POST=*
xdebug.show_local_vars=On
xdebug.dump.SERVER=*
xdebug.dump_globals=On
xdebug.collect_params=4

我遵循了这两个教程,并且可以在99%的项目文件中使用:

I followed these two tutorials and it works in 99% of my project files:

我使用Zend Frameworks MVC架构.我可以在大多数控制器类的断点处停止,但是在其他一些控制器中,PHPStorm会忽略所有断点.

I use Zend Frameworks MVC architecture. I am able to stop at breakpoints in most of my controller classes, but in some other controllers PHPStorm ignores all of my breakpoints.

您有什么建议吗?如何调试调试器?什么样的配置错误可能会导致这种情况?

Do you have any suggestions? How can I debug the debugger? What kind of configuration error could cause that?

感谢您的帮助.

推荐答案

这几乎一定是phpstorm中路径映射错误的结果.您可以在设置"->"PHP"->服务器"中配置路径.我遇到了类似的问题,我所要做的就是在phpstorm中为我的代码根目录的映射中的服务器(运行xdebug的服务器)上设置正确的绝对路径.例如 c:\ my \ code \ lives \ here \ on \ my \ dev \ box =>/myserver/my/code/lives/here/on/my/actual/server .

This almost has to be the result of mismapped paths in phpstorm. You can configure paths in Settings->PHP->Servers. I ran into a similar problem and all I had to do was to set the correct absolute path on the server (where xdebug is running) in the mapping for the root of my code in phpstorm. e.g. c:\my\code\lives\here\on\my\dev\box => /myserver/my/code/lives/here/on/my/actual/server.

这是一个更完整的解决方案,以及一些有关调试XDebug的常规技巧:

Here is a more complete solution, and some tips on debugging XDebug in general:

  1. 将远程日志文件添加到xdebug设置: xdebug.remote_log =/path/to/logs/xdebug.log

重新启动apache

Restart apache

尾部记录(我假设您可以在OSX中完成此操作) tail -f/path/to/logs/xdebug.log

Tail the log (I'm assuming you can do this in OSX) tail -f /path/to/logs/xdebug.log

-通过在下次尝试调试页面时跟踪日志内容,您可能会发现明显的错误.如果是这样,则只需执行您需要做的任何事情即可.如果没有,我们仍然假设这是路径映射错误并继续尝试修复:--

--You might see something obviously wrong by keeping track of the log contents the next time you try to debug a page. If so, just do whatever you need to do. If not, let's still assume it's a mismapping of paths and continue to try to fix that:--

  1. 设置一个断点,您知道PHPStorm/XDebug实际上将停止并使其停止在此.在网络上的许多地方,人们报告index.php是使PHPStorm首次真正在断点处停止的最简单位置.

  1. Set a breakpoint where you know PHPStorm/XDebug will actually stop and make it stop there. In a lot of places on the web people report index.php being the easiest place to make PHPStorm actually stop at a breakpoint for the first time.

在一个无法使PHPStorm/XDebug停止的文件中,设置和取消设置断点,而PHPStorm停止在index.php文件中的断点处.您应该在xdebug日志文件中看到如下所示的行:

In a file that you can't get PHPStorm/XDebug to stop in, set and unset a breakpoint while PHPStorm is stopped at the breakpoint in the index.php file. You should see lines in your xdebug log file that look like this:

<-breakpoint_set -i 19 -t行-f文件:///myserver/my/code/lives/here/on/my/actual/server/file.php -n159->

<- breakpoint_set -i 19 -t line -f file:///myserver/my/code/lives/here/on/my/actual/server/file.php -n 159 ->

  1. 查看文件是否确实存在,例如XDebug正在寻找它的位置.

tail/myserver/my/code/lives/here/on/my/actual/server/file.php

  1. 如果文件实际上不存在于此,请调整PHPStorm设置中的路径映射,直到PHPStorm告诉XDebug查看实际存在的文件为止.例如如果XDebug说 file =/mysrver/my/code/lives/here/on/my/actual/server/file.php ,那么在第6步中您会注意到该文件不存在在服务器上,然后您可能会意识到哦,我在路径映射中将myserver拼写错误",然后在PHPStorm中修复拼写可能就可以解决问题.
  1. If the file doesn't actually live there, adjust the path mappings in your PHPStorm settings until PHPStorm is telling XDebug to look at files that actually exist. e.g. if XDebug had said file=/mysrver/my/code/lives/here/on/my/actual/server/file.php, then in step 6 you would have noticed the file didn't exist on the server, and then you might realize "oh oops I spelled myserver wrong in the path mapping", and fixing the spelling in PHPStorm would then probably fix the issue.

这是一个旧线程,但希望这最终会帮助某人:)

This is a bit of an old thread but hopefully this will help someone eventually :)

这篇关于PHPStorm/调试器不会在某些断点处停止的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆