PHP xdebug only on localhost?

I'm trying to debug php pages on a remote server. But it will not work as supposed. I tried out various configurations and settings. Everything works fine when the http Server runs on the local machine. But the debugger is waitng for connection on port 9000 when trying to connect to a webserver in my local network. When trying to connect with an other Xdebug client like Eclipse everthing works fine.

But one after the other (the setup I'm using):
The server (e.g. local ip 192.168.0.1) is running with a WAMP installation (Apache/2.2.11 (Win32) PHP/5.2.6 and DOCUMENT_ROOT    D:/opt/wamp/www/ )
The client (e.g. local ip 192.168.0.2) Intellij 9.0.1, Windows XP, Content Root (e.g. C:\dev\www\ , with at least one file phpinfo.php)

php.ini on 192.168.0.1

zend_extension_ts="d:/opt/wamp/bin/php/php5.2.6/ext/php_xdebug-2.0.5-5.2.dll"
xdebug.remote_enable=1
xdebug.remote_host="192.168.0.2"
xdebug.remote_port=9000
xdebug.remote_handler="dbgp"
xdebug.remote_mode=req
xdebug.remote_log="d:/opt/wamp/logs/xdebug.log"
xdebug.profiler_enable=1
xdebug.profiler_output_dir="d:/opt/wamp/tmp/"
xdebug.collect_params=On
xdebug.show_local_vars=On


PHP setting in IntelliJ

Server Root: http://192.168.0.1
XDebug port: 9000
PHP directory: c:\php\ph5.2.6 (a local php directory)


Run/Debug config: (e.g. phpinfo.php)

Web path: http://192.168.0.1/phpinfo.php
Browser: FF
Debug: Open web page in browser....
Path Mappings:
Local Client    Local Server             
C:\dev\www\  => D:\opt\wamp\www


I also tried to set a specific idekey in php.ini and in "wait for xdebug..." in the Run/Debug Configurations, with and without mapping, with auto mapping and so on... but allways the same problem: IDEA is still waiting for conection on port 9000.
Additionally I added the appropriate category to log.xml. -> no exceptions in the log...

So what's the/my mistake?

Thanks in advance
Max

6 comments
Comment actions Permalink

Hello Max,

Thanks for the detailed description,

This is usually caused by wrong client IP specified at server's php.ini, but this is not the case since you can successfully debug in Eclipse running on the client machine.
Does the 'phpinfo.php' web page show up in the browser at all?

Could you please attach the Web IDE log with

  <category name="com.jetbrains.php.debug">
    <priority value="DEBUG"/>
  </category>

part added to the log.xml (as you likely already done ).

Also, XDebug writes it's own log at the server, configured by

xdebug.remote_log="d:/opt/wamp/logs/xdebug.log"

This one may also help.

Thanks,
Kirill

0
Comment actions Permalink

Hello Kirill,

yes the webpage is displayed in the browser at all. I already inserted the category in the log.xml. But there are no interesting entries, solely:

2010-02-07 12:15:39,390 [ 332797]   INFO - bug.dbgp.DbgpConnectionManager - Debug session IDEA1 started
2010-02-07 12:15:39,390 [ 332797]   INFO - nection.ServerSocketConnection - Starting to listen on port 9000
2010-02-07 12:15:39,390 [ 332797]   INFO - tbrains.php.run.PhpDebugRunner - Starting debug session: IDEA1
2010-02-07 12:15:39,406 [ 332813]  DEBUG - ains.php.debug.PhpDebugProcess - Opening URL: http://192.168.0.1/phpinfo.php?XDEBUG_SESSION_START=IDEA1


No xdebug.log will be created on server at this time!

Looking at eclipse - the settings are nearly the same (I guess):

PHP Debugger XDebug  (port 9000)
Server http://192.168.0.1
pathmapping:
- Path on Server: d:\opt\wamp\www
- Localpath: (Projectpath: /www, or Filepath : C:\dev\www\)


Eclipse uses this url form debugging:

http://192.168.0.1/phpinfo.php?XDEBUG_SESSION_START=ECLIPSE_DBGP&KEY=12655434089211


Now there's the expected xdebug.log on server starting with....

-> <init xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" fileuri="file:///D:/opt/wamp/www/phpinfo.php" language="PHP" protocol_version="1.0" appid="2472" idekey="ECLIPSE_DBGP"><engine version="2.0.5"><![CDATA[Xdebug]]></engine><author><![CDATA[Derick Rethans]]></author><url><![CDATA[http://xdebug.org]]></url><copyright><![CDATA[Copyright (c) 2002-2009 by Derick Rethans]]></copyright></init>
..........

I tried out Xdebug 2.1.0beta, too. There's a new feature implemented:

xdebug.remote_connect_back
Type: boolean, Default value: 0, Introduced in Xdebug 2.1 If enable, the xdebug.remote_host setting is ignored and Xdebug will try to connect to the client that made the HTTP request. It checks the $_SERVER['REMOTE_ADDR'] variable to find out which IP address to use. Please note that there is no filter available, and anybody who can connect to the webserver will then be able to start a debugging session.

but as you can imagine - no success...
...other suggestions? Has anybody else succeeded to get the debugger run with the exception of localhost?


Best regards,
Max



0
Comment actions Permalink

Hello Max,

What I see is that for some reason Xdebug is not triggered when the page is opened by IDEA.

Also please check that 'XDEBUG_SESSION' cookie is set when you open the page using IDEA and Eclipse.

Also pleaae choose the option 'Wait for Xdebug connection with ide key', specify there an Eclipse' one: 'ECLIPSE_DBGP' and try opening the page manually:

http://192.168.0.1/phpinfo.php?XDEBUG_SESSION_START=ECLIPSE_DBGP


Does debug start this way?

Thanks,
Kirill

0
Comment actions Permalink

Thank you for the quick reply.

No I'm sorry, but this is still not the solution (workaround). I changed the key manually in the run/debug config to ECLIPSE_DBGP, started a browser (tried with ff and ie) - no success. It really drives me to despair.
Interestingly there's no Xdebug session cookie when using Eclipse. It's only available when IDEA tries to connect.

Removing or changing the xdebug.remote_host config in php.ini I get the expected result: the debugger doesn't work anymore ;-)

0
Comment actions Permalink

I found it! I found it! I found it!

The windows firewall caused the unnecessary stress. IDEA was not allowed to connect to.
I apologise for my mistakes. What a mess!


Thank you for your support, Kirill

0

Please sign in to leave a comment.