phpstorm 和 xdebug 断点

发布于 2024-11-14 03:32:55 字数 202 浏览 1 评论 0原文

我使用 phpstorm 开发网站,但由于某种原因断点不同步。这是我的情况:

我有一个文件夹,其中保存了我的所有项目。在同一台电脑上,我还运行 xampp 作为测试服务器。在 phpstorm 中,我将 xampp 测试服务器配置为已安装的文件夹服务器。但是当我在原始源文件中应用断点时,这些断点与 xampp 的 htdocs 文件夹中的文件不同步。我该如何解决这个问题?

I use phpstorm to develop websites, but for some reason breakpoints aren't synchronized. Here is my situation:

I have a folder in which I keep all my projects. On the same pc, I have also xampp running as a testing server. In phpstorm I have the xampp testing server configured as a mounted folder server. But when I apply breakpoints in the original source files, those breakpoints aren't synchronized with the files in the htdocs folder of xampp. How can I solve this?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

神经暖 2024-11-21 03:32:55

看来您需要设置路径映射。有一些相关信息 - http://blogs。 jetbrains.com/webide/2011/03/configure-php-debugging-in-phpstorm-2-0/

Looks like you need to set path mappings. There are some information about that - http://blogs.jetbrains.com/webide/2011/03/configure-php-debugging-in-phpstorm-2-0/

清引 2024-11-21 03:32:55

当我设置断点时,我遇到了类似的问题,但在调试时并没有停止。我的网络服务器使用虚拟驱动器号来使 httdocs 路径更容易。所以我的错误是我没有将虚拟路径设置为文件设置目录中项目的内容根,而是设置为本地文件夹的真实路径

I had similar problem when I set a breakpoint but it didnt stop on it while debugging. My webserver uses a virtual drive letter to make httdocs path easier. So my mistake was that I had not set virtual path as content root of the project in File-Settings-Directories but a real path to my local folder

温柔戏命师 2024-11-21 03:32:55

我在 phpstorm 4.x / xdebug 2.2.3 / php 5.4.3 中遇到了类似的问题,

我可以在代码中设置一个断点,它会起作用,但是单步执行这些行我可以看到调试器正在获取与实际代码不同步。这意味着跳过了一些断点。

经过大量实验,我终于发现问题是由我的变量中出现换行符引起的。

例如:

    $q = "SELECT * 
    FROM table
    WHERE
    product_id = 'whatever'
    AND product_status != 'inactive'";

当调试器到达此语句时,会将调试器抛出 4 - 5 行。

将此更改为:

$q = "SELECT * FROM table WHERE product_id = 'whatever' AND product_status != 'inactive'";

解决了问题!

显然,这会影响任何带有换行符的 var 声明,而不仅仅是那些用于 SQL 查询的声明。有点痛苦,因为我这样做是为了提高可读性,但我希望这可以为遇到同样问题的其他人节省一些时间。

I was having a similar problem with phpstorm 4.x / xdebug 2.2.3 / php 5.4.3

I could set a break point high up in the code and it would work, but stepping through the lines I could see that the debugger was getting out of sync with the actual code. This meant that some break points were skipped over.

After a lot of experimentation, I finally worked that out the problem was caused by me having line breaks in my vars.

For example:

    $q = "SELECT * 
    FROM table
    WHERE
    product_id = 'whatever'
    AND product_status != 'inactive'";

would throw the debugger out by 4 - 5 lines when it got to this statement.

Changing this to:

$q = "SELECT * FROM table WHERE product_id = 'whatever' AND product_status != 'inactive'";

fixed the problem!

Obviously this would affect any var declaration with line breaks, not just those intended for SQL queries. Bit of a pain, because I do this for readability, but I hope this saves some time for someone else with the same problem.

唠甜嗑 2024-11-21 03:32:55

也许这对你不起作用,但我只是让我的 MAMP 的主文件夹指向我的项目的根文件夹,所以不需要同步/安装

Maybe this doesn't work for you but I just have my MAMP's home folder point to the root folder of my project, so no syncing/mounting is needed

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文