Remote debugging with XDebug and PHPStorm

折月煮酒 提交于 2019-12-20 09:15:50

问题


First things first:

  • Server is an Apache running on Debian in a VMPlayer
  • Host is Windows 7
  • Debugging-Server is XDebug
  • Files are directly accessible via a shared folder

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

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

Let me give you some more details:

  • IP of Server: 192.168.56.128
  • IP of my host: 192.168.56.1

the file that I want to debug is 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

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.

Run / Edit configurations / Defaults / PHP Remote Debugging:

  • Server: "Debian"
  • IDE key: -
  • Break at first line: yes

Servers:

  • Name: "Debian"
  • Host: 192.168.56.128
  • Port: 80
  • Debugger: Xdebug
  • use path mappings: yes
  • one path mapping configured:

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

Run / Edit configurations / Defaults / PHP Web Application:

  • Server: "Debian"
  • Start URL: /Symfony
  • Browser: Chrome
  • Break on first line: yes

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

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

Where is it ... ?

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.


回答1:


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. The important sections to configure are "Servers" and "PHP Remote Debugging".

  2. 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!

  3. 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.




回答2:


If you are still having problems, there are two blog posts by the makers on how to set things up correctly.

First should work in most cases and requires zero-configuration other than a working xdebug install

Second details all of the configuration settings in detail




回答3:


To 'see' the profile.ini in the PHP Storm 'Select File' Dialog simply rightclick inside of it and choose 'Show hidden files' then (in WIn7) move to C:\Users\YOURUSERNAME\AppData\Roaming\Mozilla\Firefox or the equivalent in your OS




回答4:


  1. Ensure that remote debugging is enabled in php.ini

    xdebug.remote_enable = 1

  2. Your server "192.168.56.128" should be in PHP-> Servers

  3. Add PHP Web Application Debug Configuration, and use added server
  4. Set a breakpoint and start debugging using this configuration


来源:https://stackoverflow.com/questions/7234471/remote-debugging-with-xdebug-and-phpstorm

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!