19

i's like to get remote debugging to work with the following software configuration:

Win 7 Pro 64bit WAMP Server 2.2 (32bit) incl. Apache 2.2.22, PHP 5.4.3, XDebug php_xdebug-2.2.1-5.4-vc9.dll JetBrains PHPStorm 4.0.3

1.) WAMP is up and running, my site can be found under localhost/fox/

2.) PHP Storm has a project where there is a mapping between my sourcefiles and the apache alias localhost/fox

2.) I installed the php extension XDebug and added the following lines to my php.ini

[xdebug]
zend_extension="c:/wamp/bin/php/php5.4.3/zend_ext/php_xdebug-2.2.1-5.4-vc9.dll"
xdebug.remote_enable=On
xdebug.remote_host="localhost"
xdebug.remote_port=9000
xdebug.remote_connect_back=On
xdebug.remote_autostart=On
xdebug.profiler_enable=On
xdebug.profiler_enable_trigger=off
xdebug.profiler_output_name=cachegrind.out.%t.%p
xdebug.profiler_output_dir="c:/wamp/tmp"
xdebug.remote_log="C:/wamp/tmp/xdebug.log"
xdebug.remote_cookie_expire_time=6000

This should configure the Remote Debugging XDebug and the call back address.

I check already my installation here: xdebug.org/wizard.php

3.) I configured phpstorm, first i added the local server

and then checked my settings here

http://www.bilder-hochladen.net/files/jrn0-2-c81e-jpg-nb.html

( i tried 127.0.0.1/fox as Server address as well, and localhost instead)

hier my debug settings: http://www.bilder-hochladen.net/files/jrn0-1-c4ca-jpg.html

Now i restart my apache, i go into phpstorm, set a break point (it is red), click the function

Run  -> Start listen to PHP Debug Connections

The telephone receiver is turing into green, what ever that exactly could mean but it's a positiv signal to me.

When I now run my php Script on the local webserver absolutley nothing happens, the programm runs over the break point and does not stop.

In the Xdebuggers log (C:/wamp/tmp/xdebug.log) i find loads of these messages like these:

 I: Checking remote connect back address.
 I: Remote address found, connecting to ::1:9000.
 E: Could not connect to client. :-(
 Log closed at 2012-07-19 14:21:08

Somewhere in the internet i found the hint, that the windows firewall could block the communication so i turned it off completley but that did not help.

I also tried to connect via telnet to localhost:9000 and i got a response from phpstorm.

Has anybody an idea where to search the error or what else i could try to get this stuff working ?

Thank you very much for your help in advance, Michael

p.s. Sorry i am not allowed to post more than two links because I am new here, so therefor no hyperlink to the xdebug wizard.

cimmx
  • 191
  • 1
  • 1
  • 4
  • 2
    Use TcpView, netstat, Process Explorer or similar tool to verify that PhpStorm is listening on port 9000. Then try to connect to it using `telnet 127.0.0.1 9000`. If telnet works, XDebug should also work. If not, it's some networking issue. – CrazyCoder Jul 19 '12 at 15:21
  • Are you using one of the PHPStorm bookmarklets from your browser to activate the debugger (or equivalent)? – redbirdo Jul 19 '12 at 15:35
  • Hi CrazyCoder, i forgot to mention that i tried the telnet and it worked phpstorm is listening. thx anyway. – cimmx Jul 19 '12 at 16:28
  • 1) You have `xdebug.remote_connect_back=On`, therefore this option is ignored `xdebug.remote_host="localhost"`. 2) I suggest following this article -- works perfectly every time (try it on **new simple project** first): http://confluence.jetbrains.net/display/WI/Zero-Configuration+debugging+with+PhpStorm+2.0 – LazyOne Jul 20 '12 at 09:10
  • "PHP Storm has a project where there is a mapping between my sourcefiles and the apache alias localhost/fox" -- *possibly* the problem is here. What kind of mapping? Where did you provide it ("Settings | PHP | Servers"? or maybe "Settings | Deployment" ? etc)? – LazyOne Jul 20 '12 at 09:12
  • Hello LazyOne, so i got it work in a simple project. I am on the way, as soon as i figured out what my problem is in the larger project I will give myself an answer. Thanks for your help. – cimmx Jul 20 '12 at 13:02
  • Ok, the problem was that a cookie let the xdebug-er connect wrong. There is no other explanation. – cimmx Jul 20 '12 at 13:31
  • I found a very nasty little problem with PhpStorm and remote debugging. Granted, I develop on Linux, but Windows has the same issues I'm sure. If your source path (in mappings) is not the actual REAL PATH to your source, the debugger will not stop at break points. This is evident when using symbolic links in Linux. If you're projects are stored under C:\Users\You\xyz, you might try moving them to a root directory and see if that helps. Just my $0.02USD. – lucifurious Jul 21 '12 at 16:44
  • @lucifurious Have you tried setting up **proper** path mappings in "Setting | PHP | Servers" ?? **Works perfectly**. – LazyOne Jul 22 '12 at 12:05
  • Doesn't work anymore. I tried everthing you suggested me, look my Mappings here : [link](http://www.bilder-hochladen.net/files/jrn0-3-eccb-jpg.html) I am a little bit desperate, i reinstalled everthing, deleted all my settings, nothing helped. A friend of mine uses the exactly same setup and it works ... thx anyway. – cimmx Jul 24 '12 at 11:20
  • @cimmx you have unreviewed answers – Áxel Costas Pena Oct 07 '14 at 19:59
  • Thanks @CrazyCoder After doing the telnet thing and seeing it hang I had a lightbulb moment and reliased it was Ubuntu's firewall. Doing this opened the port: `sudo ufw allow 9000` – Force Hero Jan 17 '17 at 11:03

3 Answers3

13

Maybe a bit late but...

Here you have a contradiction on your settings:

xdebug.remote_host="localhost"
xdebug.remote_connect_back=On

Those two settings overlap. What is your case?

a) You want to debug your application just from one single origin (for example, you are developing from and deploying to localhost).

Then you are almost done: you have already defined that the remote host is localhost. Comment out the remote_connect_back line (with ;)

b) You want to accept multiple development sources (for example, several machines debugging the application in the same network).

Then the remote_host line is being overriden, so you can remove or comment it.

This is effectively the configuration you are currently running. So, what's wrong with it? Check it out running this script:

<?
echo $_SERVER['REMOTE_ADDR'];

The output will be ::1. Well, the host which is making the request to your Apache server is localhost. And Apache is resolving that name as the IPv6 address ::1, which in the end is not wrong. But Xdebug is unable to connect to an IPv6 address. See:

I: Remote address found, connecting to ::1:9000.
E: Could not connect to client. :-(

So our goal will be to make Apache to resolve localhost preferably to an IPv4 address (without disabling any support for IPv6 at OS level nor at Apache level). This may be achieved by adding to your hosts file the next line:

127.0.0.1 localhost

This simple hack will do the trick! Now localhost will always preferably be resolved as an IPv4 address, while ::1 will still be perfectly understandable.

Áxel Costas Pena
  • 5,886
  • 6
  • 28
  • 59
6

You can try to disable IPV6 http://support.microsoft.com/kb/929852, I think this is the problem, when you try to connect.

Remote address found, connecting to ::1:9000.

System are try to connect with IPV6 and I think that XDebug are only enable to IPV4.

sbarrat
  • 109
  • 4
  • Thank you! My MAMP Pro virtual host configuration automatically adds IPv6 localhost entries (::1) to /etc/hosts. After removing them xDebug worked again as expected! – Matthias Kleine Jul 05 '17 at 14:21
0

Where exactly is your breakpoint in your code? I know that XDebug can be funny.

For PHP 5.4, your Xdebug settings should be

[XDebug]
zend_extension="<path to php_xdebug.dll>"
xdebug.remote_enable=1
xdebug.remote_port="<the port for XDebug to listen to>" (the default port is 9000)
xdebug.profiler_enable=1
xdebug.profiler_output_dir="<AMP home\tmp>"

http://www.jetbrains.com/phpstorm/webhelp/configuring-xdebug.html

bear
  • 11,364
  • 26
  • 77
  • 129
  • What is xdebug.profiler_output_dir asking for? The path to tmp directory on the system? I am using Ubuntu, so should it be set too: /tmp ? – johnsnails Dec 03 '13 at 06:01
  • @johnsnails The directory where the profiler output will be written to, make sure that the user who the PHP will be running as has write permissions to that directory. It defaults to `/tmp` – bear Dec 03 '13 at 10:27