doupeng6890 2015-01-21 03:07
浏览 93
已采纳

在XDebug for Eclipse中,远程路径如何映射到本地路径?

Although I now realize that the trick to getting Eclipse to stop at your breakpoints, when PHP scripts are executed from POST and GET requests from ajax/curl, is to make sure the XDEBUG_START_SESSION variable is set in all the requests you want the debugger to be aware of, this seems to only work when all of your paths on the web server are the normal relative kind.

However, if you happen to have some aliased paths on the webserver, such as by way of the httpd Alias directive, XDebug then has trouble associating the paths of the files in your workspace with their path in a site URL.

I have the following directory setup:

Directory Setup

Here's how the web server is setup:

ServerName test.local
DocumentRoot "C:\Users\me\projects\testproject\start\here"
Alias /post "C:\Users\me\projects\testproject\post"

<Directory "C:\Users\me\projects\testproject">
    Require all granted
</Directory>

I would think this is what the Path Mapping tab is for, found in Debug Configurations -> Server -> Configure... -> Path Mapping. Everywhere I look, I'm told to set Path on server to the filesystem path on the webserver for a directory or file, and to set Local path to its path in your filesystem or workspace. I also tried setting Path on server to the site URL path I wanted to map to the Local path, but neither configuration results in breaking on a line in a POSTed PHP script.

I turned on logging for XDebug, to compare messages for a breakpoint that it properly stops on, because it's in the file the the debugger starts at, and a breakpoint in the script executed by way of POST request, which is unfortunately not stopping. It will stop in this file if the /post path correspond with a post directory at the DocumentRoot, but not if the post directory is somewhere else and the "fake" /post path in the site URL is aliased to it.

In my XDebug log file, there are several log entries for line 28 in index.php, the file for which it is properly breaking. Line 3 in message.php has an entry as well, and the URL-encoded path looks correct, but I'm not seeing the same kind of entries.

How can Eclipse be configured to know that /post on the server means /My Project/post in the workspace?

  • 写回答

1条回答 默认 最新

  • douxin5953 2015-01-25 16:01
    关注

    Oh my... it was simply a matter of setting Accept remote session (JIT) to localhost, in my case, or just anything other than off:

    Accept remote session

    It's great to confirm that this does fundamentally work, but I'm still confused as to why it's not in a much more complex project. With luck, I'll have more to share...

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 对于相关问题的求解与代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 信号傅里叶变换在matlab上遇到的小问题请求帮助
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作
  • ¥15 求NPF226060磁芯的详细资料