使用XDebug和PHPStorm进行远程调试 [英] Remote debugging with XDebug and PHPStorm

查看:138
本文介绍了使用XDebug和PHPStorm进行远程调试的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

第一件事:

  • 服务器是在VMPlayer上的Debian上运行的Apache
  • 主机是Windows 7
  • 调试服务器是XDebug
  • 可通过共享文件夹直接访问文件

重要:XDebug已在Apache和Win7防火墙上正确配置. 我知道我可以使用Eclipse进行调试.

Important: XDebug is properly configured on Apache and my Win7 firewall as well. I know that b/c I can debug using Eclipse.

所以我无法提供的似乎是PHPStorm的基本配置.

So what I am failing at seems to be the basic configuration of PHPStorm.

让我为您提供更多详细信息:

Let me give you some more details:

  • 服务器IP:192.168.56.128
  • 我的主机的IP:192.168.56.1

我要调试的文件是index.php:

the file that I want to debug is index.php:

    我的Win7主机上的
  • 位置:C:\ dev \ sf \ Symfony \
  • 在Debian上的位置:\ mnt \ hgfs \ sf \ Symfony \
  • URL:192.168.56.128/Symfony/index.php
  • location on my Win7 host: C:\dev\sf\Symfony\
  • location on Debian: \mnt\hgfs\sf\Symfony\
  • URL: 192.168.56.128/Symfony/index.php

无论我如何摆弄……我都会收到奇怪的错误消息,例如正在等待来自JetBrains PhpStorm的连接..."或PHPStorm向我询问Mozillas profile.ini,即使我在Web浏览器中将Chrome配置为默认"也是如此.

No matter what I fiddle together ... I get weired error messages like "Waiting for connection from JetBrains PhpStorm..." or PHPStorm asks me for Mozillas profile.ini, even though I configured Chrome as Default in Web Browsers.

所以我将建立一个新项目,希望有人告诉我我的配置出了什么问题.

So I will just set up a new project and hopefully someone tells me what is wrong with my configuration.

运行/编辑配置/默认设置/PHP远程调试:

  • 服务器:"Debian"
  • IDE键:-
  • 在第一行中断:是

服务器:

  • 名称:"Debian"
  • 主机:192.168.56.128
  • 端口:80
  • 调试器:Xdebug
  • 使用路径映射:是
  • 已配置一个路径映射:

C:\ dev \ sf \ Symfony =>/mnt/hgfs/sf/Symfony(也尝试过/Symfony-b/c PHPStorm不在乎/Symfony之上的任何东西!?)

C:\dev\sf\Symfony => /mnt/hgfs/sf/Symfony (also tried /Symfony - b/c PHPStorm shouldn't care about anything above /Symfony !?)

运行/编辑配置/默认设置/PHP Web应用程序:

  • 服务器:"Debian"
  • 起始网址:/Symfony
  • 浏览器:Chrome
  • 在第一行中断:是

现在我选择:运行/调试.../1.index.php

Now I choose: Run / Debug ... / 1.index.php

然后我被问到:Mozilla的profile.ini ...但我找不到

And I get asked for: Mozilla's profile.ini ... but I can't find it

它在哪里...?

到目前为止,PHPStorm已启动Chrome.但是也许我首先解决这个问题.那么,如何启动和运行Firefox?我还将Firefox与Eclipse结合使用...毫无疑问要求profile.ini.

I already got so far that PHPStorm started Chrome. But maybe I first sort this out. So how can I get Firefox up and running? I also use Firefox with Eclipse ... no questions asked for a profile.ini.

推荐答案

好,我想与您分享三件事.这不是完整的食谱,但最令我困惑的关键因素是:

Okay, there are three things I'd like to share with you. It's not the full recipe but the key ingredients that were first confusing me are:

  1. 要配置的重要部分是服务器" "PHP远程调试" .

要配置"PHP远程调试",您必须首先使用左上角的[+] 添加新的数据集.通过单击"PHP R D"按钮获得的面板仅保留默认设置

To configure "PHP Remote Debugging" you have to first add a new dataset using the [+] in the top left corner. The panel you get from just clicking on the "PHP R D"-button just keeps the default settings!

关于VM的绝对路径实际上是指从根开始的绝对路径(\ mnt \ hgfs \ sf \ Symfony).这让我感到困惑,因为我仍然不确定为什么PhpStorm在乎共享文件夹上方的目录级别.但确实如此.

Absolute path regarding the VM actually means the absolute path starting from root (\mnt\hgfs\sf\Symfony). This was confusing to me cause I am still not sure why PhpStorm cares about directory levels above the shared folder. but it does.

这篇关于使用XDebug和PHPStorm进行远程调试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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